Re: Deleting files from one directory that are not present in another



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
.



Relevant Pages

  • Re: War Celebrations
    ... If the factories cannot be stopped any other way, I have no problem in the ... morality of blowing up estates full of factory workers who spend their ... are a legitimate target, but I suspect that usually the workers from diverse ... Command were not entirely those under the command of Adolf ...
    (uk.legal)
  • Re: War Celebrations
    ... are a legitimate target, but I suspect that usually the workers from diverse ... As the winter of 1943 approached, the forces aligned against Bomber ... Command were not entirely those under the command of Adolf ... Lindemann's minute on area bombing, ...
    (uk.legal)
  • Re: U.S. Navy taking on pirates, sort of
    ... Open-ended bureaucratic blather accompanied by actual ... little or no radio communications except in the "command" a/c. ... waving a sign with the target bearing boldly chalked (and woe to he who ...
    (sci.military.naval)
  • Re: Automated Deployment Services and VSMT
    ... I put the target and master server in the same switch. ... Ran the capture and it worked fine. ... > command to return the geometry of your hard-disk. ...
    (microsoft.public.windows.server.setup)
  • Re: Suggestion Question
    ... So if the target is told "I suggest you give 1gp to every ... command spoken to you in elven you follow that command." ... ended influence over a victim, but to have the victim perform a ... Elvish" is open-ended and nonspecific, ...
    (rec.games.frp.dnd)