JIM.H. said:
Hi,
I need to find all the *.xls files in the current and sub folders and copy
all the *.xls to a different server with the same folder structure and then
delete only *.xls in the source folders by keeping the folders.
How can I do this in a batch or a vbscript?
HMM
I'm sure that xcopy will scan through the subdirectories and find all
the xls files, but i'm not sure whether it can copy them to the
corresponding subdirectories.
To do this right, you don't want to touch the destination structure in
any other way.
So, you don't jut want to overwrite everything in the destination.
a barmy way that'd do it would be to copy the whole lot, somehow
*prompting for* every single file copy(even if the file doesnt' exist
at the destination), and then only *confirm* for the xls files.
another way woudl be fsync. It'll pick up the xls files to transfer
and copy them to the correspondign structure. You then choose which to
transfer. . I think. I don't use fsync much.
Hey , I know!!
i've never doen this but i've planned on it.
you use attrib and xcopy
the solution is to do with
attrib /a
and xcopy /a and /m
You can use attrib, so that when xcopy runs it'll only copy certain
files of your choosing.
It should copy them to the corresponding structure because you'd tell
it to copy the whole parent source directory including subfolders. to
the destination. And it'd only copy the files specified
traditionally the attrib /a and xcopy /a/m are to do with backus. So
you are telling xcopy that certain files in the source directory have
been amended and so should be copied. The rest haven't been amended and
so shouldn't be copied. It's done like that to save time..
hmm,. actually there's still a weakness there. It'll copy files in
source that aren't in dest. So, you'll tell it to only copy *.xls.
now it's fine.
You don't need a batch file of vbscript..
To delete all xls files going through the subfolders. There are 2
ways..
There was a time when pc magazine came up with a program called sweep,
which would run a command in subdirectories.
So sweep del *.xls
But I think the FOR command will do it. You can tell it to recurse
through subdirectories look for - say - *.xls, and run whatever
command.
Was this post helpful to you?
Why
yes.. just don't charge for the solution on some commercial site!!
experts-exchange are enough of a nuisance doing that.