Jump to content

Preventing file from being overwiten


MobilAdmin
 Share

Recommended Posts

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...