q; move files to another server

G

Guest

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?



Was this post helpful to you?

Why
 
G

Guest

Hi Jon,
Thanks for the reply, how can I delete *.xls files in the sub folders
without deleting the folder?
 
B

Bob I

Why do you believe the folders would get deleted if the command was

DEL *.xls

????????
 
Q

q_q_anonymous

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.
 
Q

q_q_anonymous

Bob said:
Why do you believe the folders would get deleted if the command was

DEL *.xls

????????

he said he wanted to go through subdirectories. So del wouldn't do it.

in the DOS days (win98 DOS and before, like DOS 6.22 and before that)
there was deltree.

that'd have deleted the directories.
..
win xp doesn't have deltree. It has rmdir (or rmdir /s), which would
also delete the directory.

sweep.com , or using the for command with the del command. Or writing
a qbasic program to do it, are not so obvious. Well, the qbasic
program might be ;-) But it's not generally done in win xp. I haven't
used it for years anyway !


note- it seems old DOS, along with the decent deltree command, had a
rather impotent rmdir that couldn't delete non empty directories !!
http://www.vfrazee.com/ms-dos/6.22/help/rmdir.htm#Notes

note2-
dir /b/s gets all the paths of all xls files.
you could redirect that to a file. dir /b/s >a
How to then delete those files listed in a?
Well, you could bounce off the command prompt. - isntead of using
qbasic with the SHELL command.
 
J

Jon

del *.xls /s

That will delete the .xls files in subdirectories, but preserve the
directory structure.

--
Jon

Give us the tools and we will finish the job
--Winston Churchill

It's certainly worth mentioning that "JIM.H."
 
Q

q_q_anonymous

Jon said:
del *.xls /s

That will delete the .xls files in subdirectories, but preserve the
directory structure.

thanks Jon

this is very significant. I hadn't realised that windows xp had updated
the del command!!

in msdos 6.22 you didn't have that option
http://www.vfrazee.com/ms-dos/6.22/help/del.htm

Is there a list of amendemnts of commands from msdos 6.22 to windows
xp?

I don't mean new commands, I mean switches added to old ones. Or
functionality changing in some way.


(I don't know about NT. As far as I know , del /s is an XP innovation)
 
J

Jon

You are probably correct. It's a number of years since I've spent a long
time with DOS, and I tend to forget commands I learned a year ago, let alone
5 - 10 years ago :)

This may get you started if you want to research it in more depth
http://en.wikipedia.org/wiki/MS-DOS
 
Q

q_q_anonymous

Jon said:
You are probably correct. It's a number of years since I've spent a long
time with DOS, and I tend to forget commands I learned a year ago, let alone
5 - 10 years ago :)

<snip>

I was correct in stating that you were correct. Since you were only
talking about the Windows XP command prompt. You never claimed that
msdos had that option!

Why go to wikipedia to check out something about an msdos
command?!!!!!!

Just check the help in windows xp against the help in msdos.
Win xp help- start....run....hh ntcmds.chm [1]
msdos help- http://www.vfrazee.com/ms-dos/6.22/help/

You should recognise that msdos help link as an online replica of the
msdos help - as in HELP.COM. That link is a useful anachronism. You
would have looked at that content back then. Rather than research with
wikipedia!!


[1]

I learnt hh ntcmds.chm Wesley Vogel mentioning it. Two useful threads
with WV's contributions, on the windows xp command prompt documentation
are.

newsgroup: microsoft.public.windowsxp.newusers
thread: "Miniapps within XP"
link:

newsgroup: microsoft.public.windowsxp.general
thread: "Run... Command List" (also mentions the above threads)
link:
 
J

Jon

Why go to wikipedia to check out something about an msdos
command?!!!!!!

Your first response to me suggested that you were interested in pinning down
the precise point in the DOS (+ Windows command line) timeline that the
innovation was introduced.

For example, it appears that the '/s innovation' was also present in Windows
2000.
http://www.microsoft.com/windows2000/en/server/help/del.htm

So the value of the link I posted was its showing of the history of the
various different DOS / Windows command line versions in the 'History'
section of the article ie the various versions between 6.22 and the Windows
XP command line.

Someone with an inclination + a bit of time on their hands could pin it down
more precisely.

--
Jon

Adversity makes strange bedfellows

message news:[email protected]...
 
Q

q_q_anonymous

Jon said:
Your first response to me suggested that you were interested in pinning down
the precise point in the DOS (+ Windows command line) timeline that the
innovation was introduced.

For example, it appears that the '/s innovation' was also present in Windows
2000.
http://www.microsoft.com/windows2000/en/server/help/del.htm

So the value of the link I posted was its showing of the history of the
various different DOS / Windows command line versions in the 'History'
section of the article ie the various versions between 6.22 and the Windows
XP command line.

Someone with an inclination + a bit of time on their hands could pin it down
more precisely.

that is interesting,

thanks

<snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top