|
Answer» Hey guys,
I created a batch file that will make a copy of a file and put it in another folder in a different drive. I would now like to create a batch file that will make a copy of a file and put it in a backup folder and also take the file in the backup folder an put it in an exisiting ARCHIVE folder. But I would only like the process to take place when a new file is being put into the backup folder. For example:
FILE1 07/18/07 File2 07/23/07
File1 is in the archive folder and File2 is in the backup folder. When the batch file runs and the backup folder doesn't get a new file, I do not want File2 to get COPIED to the archive folder since it will now make both folders have a copy of File2 in them. Is there a way that I can do that?
Hope this makes sense. Thanks in advance!Below HIGHLIGHTED in Red you first want it to copy the file as soon as it is created. To do this you would need a batch that runs in an endless loop with a goto pointer. It can test for new files using the XCOPY command and /s/d/y switches to test against the current files in the folder against the pickup location of those files. *If a newer file of same name exists however, it will stomp ontop of your old file, so you may want to add a batch instruction to add a date time stamp as part of the file name etc to avoid this overwrite problem.
As far as the second highlighted need for this batch, you will have to set test conditions such as IFEXIST ... do this IFNOTEXIST ... do that. The only pain here is that if using a date time stamp function to alter the file name to avoid the OVERWRITING problem of prior files of the same name, you will have to have the one folder test against the other folder of all of its files, which can be tricky and could need some tweaking to get to work correctly.
Not sure if this is any help, but this is the direction I would go with this.
------------------------- Below you wrote ---------------------------
Hey guys,
I created a batch file that will make a copy of a file and put it in another folder in a different drive. I would now like to create a batch file that will make a copy of a file and put it in a backup folder and also take the file in the backup folder an put it in an exisiting archive folder. But I would only like the process to take place when a new file is being put into the backup folder.[/b][/font][/color] For example:
File1 07/18/07 File2 07/23/07
File1 is in the archive folder and File2 is in the backup folder. When the batch file runs and the backup folder doesn't get a new file, I do not want File2 to get copied to the archive folder since it will now make both folders have a copy of File2 in them. Is there a way that I can do that?[/b][/color]
Hope this makes sense. Thanks in advance!
|