I am copying/moving files from an FTP folder to other folders on server. The 
script reads the files and copy/move to separate folders etc. No problem till 
this point.

Now the problem is that users are constantly uploading files to this folder 
using FTP client. The script is invoked using cron after every 10-15 mins, now 
what will be the fate of the files that are in the upload process when the 
script is invoked?

Yes, these files are copied and moved what was uploaded till that point, means 
corrupt files.

How I can avoid it? that script should leave those files which are being 
uploaded at the time it was invoked.

######### Start of Subroutine #############

sub copy_files {
use File::Copy;
while (glob ("*.mp3")) {
copy("home/uploads/$_", "home/backup/$_");
move("home/uploads/$_", "home/music/$_");
}
}

######################################

Thanks,
Sara.

Reply via email to