Solved

Batch script to copy updated files...

Posted on 2010-09-24
3
397 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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