Computing.Net > Forums > Disk Operating System > update set of files with new set using batch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

update set of files with new set using batch

Reply to Message Icon

Name: gman8
Date: October 22, 2009 at 05:01:11 Pacific
OS: Windows XP
Product: Microsoft / Dos
Subcategory: General
Comment:

I need a batch file that can compare the contents of 2 sets of folders (folder#1 and folder#2) by name and then do the following for all files:
If a file exists only in #1 => delete file
if file exists only in #2 => copy this file files to #1
if file (with same name) exists in both #1 and #2 overwrite file in #1 with file from #2, but only if they have different content.

Is this possible?

Cheers



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 22, 2009 at 05:56:20 Pacific
Reply:

If you're using XP this is the wrong forum.


=====================================
Helping others achieve escape felicity

M2


0

Response Number 2
Name: nbrane
Date: October 26, 2009 at 22:34:02 Pacific
Reply:

maybe:

cd folder1
for %%a in (*.*) do if not exist folder2\%%a del %%a
cd folder2
for %%a in (*.*) do copy /y %%a folder1

obv. this does the copy operation regardless of the
file's contents, but if contents are the same, what does
it matter? the copy won't change anything anyway.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: update set of files with new set using batch

Using a batch file to name a file with the system date. www.computing.net/answers/dos/using-a-batch-file-to-name-a-file-with-the-system-date/3481.html

create backup cd using batch file www.computing.net/answers/dos/create-backup-cd-using-batch-file/10385.html

Creating data files with batch www.computing.net/answers/dos/creating-data-files-with-batch/12010.html