Computing.Net > Forums > Programming > Can XCOPY do this for me?

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.

Can XCOPY do this for me?

Reply to Message Icon

Name: taylormade
Date: November 7, 2008 at 04:48:13 Pacific
OS: Win2003 Server
CPU/Ram: 4gig
Comment:

I have an xcopy batch file that has these flags set:
xcopy /c /d /h /s /i /r /y "d:\etalus" "d:\copyetalus" >> "d:\xcopylog.txt"
this configuration seems to update changed or newer files that exist on the desitination side.
But it does not remove files or folders on the destination side, if they no longer reside on the origination side.
Is there a way I can 1) make xcopy do that, or 2) do it another way?



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 7, 2008 at 05:53:26 Pacific
Reply:

No with just the XCOPY command that is aimed to copy not delete files, but adding the following statements to your batch.

Please, after testing and when you are sure all worked fine, remove the ECHO command in front of del and RD to really enable the deleting process.

pushd D:\copyetalus
for %%j in (*) do if not exist "D:\etalus\%%j" ECHO DEL "%%j"
for /D %%j in (*) do if not exist "D:\etalus\%%j" ECHO RD /S /Q "%%j"
popd


0

Response Number 2
Name: taylormade
Date: November 7, 2008 at 06:52:34 Pacific
Reply:

I just added some fake files to D:\copyetalus and ran the code. They did not get removed.
Can yo confirm for me that your code will
Remove from D:\copyetalus all of the files and folders that ARE NOT in D:\etalus.
NOTE: D:\etalus is the BIBLE and cannot be changed.
Thanks


0

Response Number 3
Name: taylormade
Date: November 7, 2008 at 08:32:38 Pacific
Reply:

hold the fort...I think things are good..
thanks


0

Response Number 4
Name: IVO
Date: November 7, 2008 at 08:34:49 Pacific
Reply:

Did you carefully read my post?

In the second paragraph, beginning with Please, after testing and , I stated you must remove the ECHO in front of DEL and RD to activate the deletion. That is for your safety.

YES, the script, if modified, does what you asked.



0

Response Number 5
Name: taylormade
Date: November 7, 2008 at 17:16:08 Pacific
Reply:

yes..as I said..Things Are Good.
Thanks for your time and talent


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Can XCOPY do this for me?

in visual basic.net can i do this.? www.computing.net/answers/programming/in-visual-basicnet-can-i-do-this/12729.html

How can i do this? www.computing.net/answers/programming/how-can-i-do-this/9063.html

log info to txt batch file www.computing.net/answers/programming/log-info-to-txt-batch-file/13658.html