Page 1 of 1 1
Topic Options
#47502 - 2003-10-31 12:09 AM copy /s create empty directory strucutre at dest
Kyle Offline
Fresh Scripter

Registered: 2000-05-30
Posts: 9
Loc: Irvine,CA USA
[Moderator (Sealeopard): Moved thread from 'Scripts' to 'styarters' forum due to lack of script in body]

Can anyone tell me why this code

copy "c:\*.txt" "h:\" /s (h: is a mapped network drive)

recreates my entire directory from C:\ on H:\?

I have a script that loops through a text file looking for specific extensions and when found copies them to the server. Everything works great except when the script complete I have a HUGE tree on the h:\ drive. The files I wanted to copy are there but also the entire tree (no files, only directories) from drive C:\.

Any ideas?

[ 31. October 2003, 14:58: Message edited by: sealeopard ]
_________________________
Kyle Shaver, MCSE [url=mailto:kyleshaver@cox.net]kyleshaver@cox.net[/url]

Top
#47503 - 2003-10-31 12:11 AM Re: copy /s create empty directory strucutre at dest
Kyle Offline
Fresh Scripter

Registered: 2000-05-30
Posts: 9
Loc: Irvine,CA USA
Oops! Just saw that my profile had an old email address... kyleshaver@cox.net is current.
_________________________
Kyle Shaver, MCSE [url=mailto:kyleshaver@cox.net]kyleshaver@cox.net[/url]

Top
#47504 - 2003-10-31 12:21 AM Re: copy /s create empty directory strucutre at dest
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This would explain it.

quote:

/s
Copies directories and subdirectories, including empty ones.

Copy seems to create the entire directory tree and copy the files you selected with the required extensions to the same directory as on the source drive.

[ 31. October 2003, 00:27: Message edited by: R2D2 ]
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#47505 - 2003-10-31 01:16 AM Re: copy /s create empty directory strucutre at dest
Kyle Offline
Fresh Scripter

Registered: 2000-05-30
Posts: 9
Loc: Irvine,CA USA
Yeah I saw that in the docs. Let me see if I can explain myself better. Let's say I've got some files in these directories

C:\Tools
C:\Kix

My routine says to only copy *.KIX files. I get h:\Tools and H:\Kix will all my .KIX files but I also get

H:\Windows ..\.. and all subdirs
H:\Program Files ..\.. and all subdirs

H:\Documents and Settings ..\.. and all subdirs

... and these directories don't contain any .KIX files. My question is how can search all directories on my local drive and only copy files with the extension i want without recreating the entire tree on the destination.

Thanks.
_________________________
Kyle Shaver, MCSE [url=mailto:kyleshaver@cox.net]kyleshaver@cox.net[/url]

Top
#47506 - 2003-10-31 01:56 PM Re: copy /s create empty directory strucutre at dest
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
Kyle,

If you had searched the board for the words "recursive copy" (for this is what you want) you would have found this thread (among others):

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=002320#000000

which would direct you to a freeware utility called XXCopy. Download and install it, and then the following command will do what you need:

code:
xxcopy c:\*.kix h: /sg  

It's a damn quick utility too - what this command does is recurse through all the subdirectories of C:, looking for files like *.kix and copy them all to the root of h:. It also flattens them all into the root of h: - it won't create the folder sttructure at all, even for folder that contain a *.kix file. So you may want to specify h:\Kix as the destination.

Try it and see! I'm quite impressed.

Breaker

[ 31. October 2003, 14:28: Message edited by: Breaker ]
_________________________
================================================
Breaker


Top
#47507 - 2003-10-31 02:02 PM Re: copy /s create empty directory strucutre at dest
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
However (trying to be too clever) this will actually do the same thing.

code:
 xcopy c:\*.kix h: /s 

[Sigh...]

[Edit]With xcopy, though, you don't have the /SG switch option to flatten the destination folder structure.[/Edit]

[ 31. October 2003, 14:03: Message edited by: Breaker ]
_________________________
================================================
Breaker


Top
#47508 - 2003-10-31 02:03 PM Re: copy /s create empty directory strucutre at dest
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
We need to be careful when recommending a "Free" Utility. XXCOPY is "Free" when used in a personal environment>

quote:

You install the XXCOPY program on a computer that is your own personal property and you are the primary user of the computer.

If you transfer files between networked computers using XXCOPY, all of the computers are also your own personal property.

Or, even if the above conditions are not met, you may still use XXCOPY for 60 days for evaluation purposes without charge.

If you want to purchase a license - http://www.xxcopy.com/#order

Otherwise, you can use ROBOCOPY.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#47509 - 2003-10-31 02:14 PM Re: copy /s create empty directory strucutre at dest
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
Kent,

You're absolutely right. However, this smacks to me of a one-off job, in which case the evaluation licence terms should be more than adequate for the task.

You may have missed my additional post, pointing out that xcopy will do the job too, and doesn't even require the reskit.

However, I'm not sure I've actually made a "recommendation" here [Wink] - merely pointed out that the tool is an option, and that from the quick glance I had at its capabilities, it seems impressive.

Its really up to Kyle whether or not he chooses to consider my suggestion (oh, all right, my recommendation) and subsequently, also up to him to pay attention to the details of the "freeware" licence.

Sorry, that was a bit serious - just felt a little like I was getting my wrist slapped for making a suggestion. You are right, though.

Breaker
_________________________
================================================
Breaker


Top
#47510 - 2003-10-31 03:00 PM Re: copy /s create empty directory strucutre at dest
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
One could alos use any of the DIR...() UDFs to enumerate the desired file and then copy them.
_________________________
There are two types of vessels, submarines and targets.

Top
#47511 - 2003-10-31 06:18 PM Re: copy /s create empty directory strucutre at dest
Kyle Offline
Fresh Scripter

Registered: 2000-05-30
Posts: 9
Loc: Irvine,CA USA
OK, I guess I need to explain a bit more. I have about 200 clients using anywhere from Win9x to XP. I originally wanted to use robocopy but it won't work on Win9x. I looked into xxcopy but I don't want to put it on all my clients (haven't tried running it from the server). In a nutshell here's what I need to do

Enumerate all local drives
Scan all folders for certain files (*.nsf, desktop?.??k, etc.... Mainly Lotus Notes files)
If the file <= 300Mb copy it to the server otherwise skip the copy but create a log file somewhere saying the file was skipped

I want to run this during the logon process to make sure everyone gets their files backed up. The ultimate goal is that everyone is getting a new machine. Users are going to be responsible for copying their own documents but I'm responsible for grabbing all their Lotus Notes database, config files, address books, etc.)

Hopefully that clarifies things a bit.

Any ideas are appreciated.
_________________________
Kyle Shaver, MCSE [url=mailto:kyleshaver@cox.net]kyleshaver@cox.net[/url]

Top
#47512 - 2003-10-31 07:07 PM Re: copy /s create empty directory strucutre at dest
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
quote:
Enumerate all local drives

This takes a while, so you should start this as an out-of-band process, e.g. a separate script spawned off the login script via RUN.

The most compatible way is to use any of the DIR...() UDFs with appropriate extension filters. Then check the resulting array of filenames for filesize. Finally, back up date appropriate files.

So, shoudl be something along a ten-line script (excluding UDFs).

[ 31. October 2003, 21:59: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#47513 - 2003-10-31 09:38 PM Re: copy /s create empty directory strucutre at dest
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
How about roaming vs. local profiles? This way, when you logoff your info is stored/updated on a central server.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 640 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.061 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org