Copy command with only new and changed files

T

Tony Girgenti

Hello.

Is there a way to copy files from one folder to another existing folder with
the same name and tell it to copy only new or changed files ?

Any help would be gratefully appreciated.

Thanks,
Tony
 
G

Guest

Yes. Use the xcopy command with the /M switch

xcopy c:\......\source\*.* /M c:\......\destination\*.*


each file has an attribute byte "A". The /M switch switches it off, and the
next time it does an xcopy, only copies files with the "A" attribute byte
set, and turns it off to " " after the copy.

You can check, verify, or change the file attributes of each directory by:

attrib *.*

I do daily backups of data files from source to destination by removing the
destination directory, recreating it, and copying everything new though.
 
G

GTS

The xcopy /d switch is much better. It will copy newer or unique files
only. The archive bit may be changed by other processes and is less
reliable.
--
 
T

Tony Girgenti

Thanks to everybody for their suggestions. Looks like i have a couple of
options. I'll have to test to see which works best for me.

Thanks again.
Tony
 
G

Guest

You're right about archive bit being changed by other programs. I do a
Norton's 9.0 which would affect the archive bit.

Which is why I copy the entire "MyDocuments" directory each day, and because
it only takes a few minutes, it' simpler this way than to figure out waht
changed.
 
S

Stan Brown

Sat, 18 Nov 2006 04:47:20 -0500 from <"Tony Girgenti" <tony(nospam)
@lakesideos.com>>:
Hello.

Is there a way to copy files from one folder to another existing folder with
the same name and tell it to copy only new or changed files ?

Not in the GUI, but in the command prompt.

Use the REPLACE command twice, once with the /A option and once with
the /U option. (I thought there was a way to do it in one XCOPY
command, but not as I read the help text.)
 
S

Stan Brown

Sat, 18 Nov 2006 04:29:01 -0800 from FrankChin
Yes. Use the xcopy command with the /M switch

xcopy c:\......\source\*.* /M c:\......\destination\*.*

No. That will overwrite *newer* files in the destination directory if
the file in the source directory happens to have its archive bit set.
And it will skip files in the source directory that don't have their
archive bit set, even if there's no corresponding file in the
destination directory.
 
G

Guest

Copying newer or changed files does not "sync" the source and destination,
which is why I recreate and copy the entire "MyDocuments" directory daily, on
schedule, at night. I do Norton's 9.0 backup in addition to offsite backup. I
don't want to take chances with the archival bit.

I use the "xcopy" in automatic mode via a batch file to do the copying. I
can't use the /d switch in xcopy, where I'll need a date, which I wasn''t
able to automate, and besides, doing it this way, I'm not syncing the files
anyway

But in the original quesiton, if it was just get to new or changed files,
not syncing files and nothing changes the "archive" bit like using backup
software, it should work in that simple case.
 
S

Stan Brown

Sun, 19 Nov 2006 03:25:01 -0800 from FrankChin
Copying newer or changed files does not "sync" the source and destination,

Of course it doesn't. As you yourself point out a couple of
paragraphs later, what the OP wanted wasn't a synch.

For those who do want a synch, Karen's Replicator is pretty good.
It's pretty much undocumented, and Karen doesn't answer email, but
the program itself is not hard to use and so far seems to do a good
job for me.

http://www.karenware.com/powertools/ptreplicator.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top