Re: Deleting files from one directory that are not present in another
- From: Lutz Kruse <l.kruse@xxxxxxxxxxxxxxxx>
- Date: Fri, 05 Dec 2008 15:08:20 +0100
PhilHibbs schrieb:
I'm trying to sync one directory with another. I've got an xcopy
command that makes sure that files on the source are present on the
target, but I also want to delete files on the target that are not
present on the source.
Currently my command looks like this:
for /R Z:\test1 %F in (*.*) do if not exist "X:%~pnxF" del "%F"
This works fine when I run it on the command prompt directly, but
doesn't work in a cmd file. I seem to remember something about having
to double up the % but I can't remember the details, I tried this in
various places but can't make it work. Any ideas?
Phil Hibbs.
Hi Phil,
you should take a look at robocopy from Windows 2003 Reskit. There is a switch /MIR (Mirror).
Lutz
.
- Follow-Ups:
- References:
- Prev by Date: Re: Need help copying files open/locked by other processes
- Next by Date: Re: Deleting files from one directory that are not present in another
- Previous by thread: Deleting files from one directory that are not present in another
- Next by thread: Re: Deleting files from one directory that are not present in another
- Index(es):
Relevant Pages
|