Solved

Batch script to copy updated files...

Posted on 2010-09-24
3
362 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now