Jump to content
Sign in to follow this  
MobilAdmin

Preventing file from being overwiten

Recommended Posts

MobilAdmin

I have a script that will move and rename a file into a different folder, then create a new file. The script works fine. When I run the script again the moved file stays the same, but the file I created gets erased. Even if there is new data in the created file. My goal is to prevent the script from creating the new file if the file that is being moved and rename already exists. This is what I have so far...

#include <File.au3>

Local $file, $rename, $renfile, $filemake

$file = FileGetTime("C:\Test1\test.txt")

$date = $file[1] & $file[2] & $file[0]

$renfile = FileMove("C:\Test1\test.txt", "C:\Test2\test" & $date & ".txt")

$filemake = _FileCreate("C:\Test1\test.txt")

Any ideas would be helpful. Thanks

Share this post


Link to post
Share on other sites
TurionAltec

FileExists()?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×