Sign in to follow this  
Followers 0
centralpressure

FileCopy doesn't overwrite

4 posts in this topic

Hello All,

Quite a noob, but looking for some help. We have a program that remote users enter information and collect data, this database is always in a specific directory. The end user is on a limited user account and many cannot access the internet through the computer that is collecting the data. In order to receive the database we provide a flash drive and ask them to run a script that (1) copies the original database to a back-up folder then (2) copies the file from the back-up folder to the flash drive. They can then send us the flash drive.

Here is a portion of the script that is used to preform this:

Copy data file, rename, and paste into backup folder

FileCopy("C:\SomeProgram\V9\data\scor.xyz", "C:\SomeProgram Data Backup\Data_SiteX.xyz", 9)

;Copy data file from the backup folder to the F drive

FileCopy("C:\SomeProgram Data Backup\Data_SiteX.xyz", "F:\Trial Data_SiteX.xyz", 9)

The problem I have is when a user goes to repeat the process, we are not getting the updated database, only the original. Am I using the FileCopy incorrectly? I also tried RunAS with the administrator account thinking the limited user couldn't copy and paste due to security reasons, but it did not work either.

Any suggestions would be greatly appreciated!

Share this post


Link to post
Share on other sites



My first attempt would be to monitor the results of the filecopy:

Return Value:

Success: Returns 1.

Failure: Returns 0.

:)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

If the program or the program's service is running, it may have a lock on the file. If the file is read only, it will not be overwritten.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

If the program or the program's service is running, it may have a lock on the file. If the file is read only, it will not be overwritten.

Thanks for the replies. We ensured that all programs were closed and verified that there was no lock file present. Also looking at the file properties the file is not read only. I feel like this should just work, but am stumped.Thanks for any other ideas.

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  
Followers 0