Solved

Batch script to copy updated files...

Posted on 2010-09-24
3
382 Views
Last Modified: 2012-06-21
Hi Experts,

I have an issue with scripting and file copying.  Essentially I want to copy a file (leave a copy in the source directory) from a directory of files if it’s been updated, into a new destination folder, much like Robocopy with the /mon does.  The file would retain the same file name after update.

However, in the destination folder it the file will be deleted after imported into an Electronic Content Mgmt (ECM) system.  Robocopy does not like this and will try and put all the files from the source that it copied into the destination folder on the next run.  Any thoughts on a good approach to this?  I’d like to use a batch file with scheduled task.  Here is an example:

Source Folder “A” with many files.
-A file is updated
-Robocopy (or other solution) monitors the update on the run and copies it into Destination Folder “B.”
-File is then imported into ECM solution
-Robocopy should not re-copy the file from the source back into the destination unless further changes have been made.

I chose Robocopy for initial use because of its great Monitoring features.

Thanks for your help!
0
Comment
Question by:savageje
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
godspropy earned 500 total points
ID: 33756426
xcopy looks like it might offer some help.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true

/m : Copies source files that have their archive file attributes set. Unlike /a, /m  turns off archive file attributes in the files that are specified in the source. For information about how to set the archive file attribute by using attrib, see Related Topics.

http://www.xxcopy.com/xxcopy06.htm

The Archive attribute is set whenever an existing file is either
    overwritten or modified (i.e., renamed or moved to another directory)
    by the file system.  A new file is usually created with the Archive
    attribute set.  The idea is to have a utility or application program
    to take the responsibility of clearing the Archive bit when a
    file is successfully backed up.
0
 
LVL 2

Assisted Solution

by:godspropy
godspropy earned 500 total points
ID: 33756452
So, basically your scheduled task can use xcopy to copy files with the /m switch. It should only copy files that have are new, have been overwritten or have been modified.
0
 

Author Closing Comment

by:savageje
ID: 33756798
Thank you for the suggestion.  I didn't even think to use the attribute switch.  It did exactly what I needed it to.

Thanks!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 55
find and replace 5 47
Need help on taking backup in postgress SQL -- Challenging question 4 58
How do I delete 2 44
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question