On Monday October 2 2006 9:03 pm, Sara wrote: > 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.
you should be locking these files wile your working with them so they can't be accessed by other processes until your done with them. Greg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>