Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xcopy - xdelete???

2,716 views
Skip to first unread message

Christine Volkwein

unread,
Dec 3, 2001, 3:40:54 AM12/3/01
to
Hi,

I've some files on a server. I want to keep a current version on my laptop. So far I used the following command in a batch to update my laptop:

            xcopy p:\Server f:\Local /S /D /E

Now I've problem how to delete files which are no longer on the server. I get a full list of all unused files with this command:

xcopy f:\local p:\server /l /s /d
But the question now is:

Is there a possibility to delete this files automatically? (I'm using Windows NT)

Thanks for your help,
      Christine

William Allen

unread,
Dec 3, 2001, 10:41:07 AM12/3/01
to
"Christine Volkwein" wrote in message

Redirect the list to a file like this:

xcopy f:\local p:\server /l /s /d>LISTFILE.TXT

Consider using the /n (generate 8.3 filename format list)
as well if it's available on your system, since it makes it
easier to process the list.

Process the texfile list with FOR /F (type FOR /? for help)

Typical command line in Batch file to process your list:

FOR /F %%V IN (LISTFILE.TXT) DO (ECHO DEL %%V)

Remove the ECHO to activate! when you've satisfied yourself
that the syntax works for you. Note that XCOPY listings may
omit the drive spec. It can be added to %%V. Also note that
XCOPY listings usually have a final multi-[Space] prefixed
filecount. You may wish to filter that line out before processing.

--
(pp) William Allen

For further references, see for example:
Microsoft Windows Shell Scripting and WSH ISBN1-931841-26-8
pages 138 onwards "Processing the Contents of Text Files"


Al Dunbar

unread,
Dec 3, 2001, 9:08:22 PM12/3/01
to
I have had some success using a "briefcase", but it depends on how the files are used if this is appropriate. If, as your example xcopy command indicate, all files are contained within a directory, you could maintain this directory on the server (or the laptop - depends, as I said above). You could then create, modify, rename, and/or delete files and/or directories on either side, and bring all into sync with an update.
 
I maintain my site's login scripts with a variation of this technique because the pipe to the PDC is quite small. In that case, the briefcase is on a local server, where all edit changes are made.
 
/Al
"Christine Volkwein" <christine...@avitech.de> wrote in message news:3C0B3A96...@avitech.de...

Simon Sheppard

unread,
Dec 4, 2001, 3:22:47 PM12/4/01
to

> "Christine Volkwein" <christine...@avitech.de> wrote in message =
>news:3C0B3A96...@avitech.de...
>
> Now I've problem how to delete files which are no longer on the =
>server. I get a full list of all unused files with this command:=20

>
> xcopy f:\local p:\server /l /s /d
> But the question now is:=20
> Is there a possibility to delete this files automatically? (I'm using =
>Windows NT)=20
>
> Thanks for your help,=20
> Christine=20

If you have the resource kit

ROBOCOPY source_folder destination_folder [file(s)_to_copy] /PURGE
-
Simon Sheppard
Web: http://www.ss64.com
email: Simon@ "

Christine Volkwein

unread,
Dec 5, 2001, 8:49:09 AM12/5/01
to
Sorry, the "Briefcase" does not work for me.

The skript is to hold a documentation local on the laptop and to get
updates.

Christine

Christine Volkwein

unread,
Dec 5, 2001, 8:47:34 AM12/5/01
to
Hey, thanks!

The FOR-Loop works very well! :-) I don't know how to filter that
"Count"-Line. Therefor this little "error" is okay for me!

:-) Christine (-:


Christine Volkwein

unread,
Dec 6, 2001, 8:56:49 AM12/6/01
to
Just to know, how can that count-line be filtered??

Tks, Christine

William Allen

unread,
Dec 6, 2001, 9:18:08 AM12/6/01
to
"Christine Volkwein" wrote in message
> Just to know, how can that count-line be filtered??
>
> Tks, Christine
>

The count line is typically right-justified in a [Space]-filled
field about 9 [Spaces] wide, so all practical filecounts will
contain leading [Spaces]. If you use the /N switch when
doing the List-only XCOPY, you will have only 8.3 names,
so none of the filespecs will contain spaces.

Therefore you can filter the one [Space]-containing-line from
an INPUT.TXT file listing with something like:

find /v " "<INPUT.TXT>OUTPUT.TXT

Type "find /?" for brief help with the FIND filter command.

The /v switch of FIND inVerts the logic and removes all lines
that contain the FIND target string. The same /v switch applies
to the more advanced FINDSTR filter, should you prefer to use that.

--
(pp) William Allen


Pixelab_Datman

unread,
Dec 19, 2001, 1:23:45 PM12/19/01
to
Rather than trying to devise a convoluted batch file,
I suggest the use of XXCOPY which is designed for common
file management operations such as the one you are trying.

XXCOPY is a XCOPY-compatible (but boldly extended) file
management utility. It is Freeware for non-commercial users.

What you want to do is basically a one switch operation:

XXCOPY p:\server f:\local /clone

This one line will not only copy all the files that need to be
updated (new files and modified files in the source), it will
remove files from the destination whose counterpart is no longer
present in the source. The /CLONE switch includes operations
/S and /E and /D and more (like /H --- includes hidden/system
files, and /R --- overwrites files that are marked read-only
and lots more).

If you want to confine the action for just removing the
extra files in the destination without copying anything,
you could do so

XXCOPY p:\server f:\local /rx/s/r/h //remove extra files fm dst

XXCOPY is not just a copy utility, it can delete files using
the same rich set of file-selection mechanisms (date, age, size,
name, wildcards, exclude,...).

Unlike Robocopy, XXCOPY is compatible with Win9x/ME/NT/2K/XP.
It also has a 16-bit version, XXCOPY16.

Visit http://www.xxcopy.com

Kan Yabumoto
==============================================================
Christine Volkwein <christine...@avitech.de> wrote in message news:<3C0B3A96...@avitech.de>...

> --

0 new messages