ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   xcopy question (https://www.scoobynet.com/computer-and-technology-related-34/62824-xcopy-question.html)

dsmith 04 January 2002 02:58 PM

Ok need a quick and dirty solution to copy one directory structure to another, but only copy files which dont exist.

e.g.

copy base1\dir1\*.* to base2\dir1\
copy base1\dir2\*.* to base2\dir2\
copy base1\dir3\*.* to base2\dir3\
copy base1\dir4\dir5\*.* to base2\dir4\dir5\
etc.

The directories are quite full so I only want to copy any new ones. I can do it using the archive bit in Xcopy but would rather it was explicity thos that dont exist already ?

Ta Deano

dsmith 04 January 2002 02:59 PM

Doh ! - Its Win2K btw :)

ChrisB 04 January 2002 03:07 PM

Must be a switch for that in XXCopy.

http://www.xxcopy.com/

netclectic2 04 January 2002 03:32 PM

/-Y Causes prompting to confirm you want to overwrite an existing destination file.

dsmith 04 January 2002 03:57 PM

Yep its the /-Y functionality (actually default unless /Y in environment) I want but to assume "no" to every question.

Otherwise it will typically be copy 3 files, answer no to about 500.

Carl, Soz if I didnt make it clear its the files I want to copy - the dir structures will be there already.

stevencotton 04 January 2002 04:01 PM

Zip the directories up then unzip them at their destination.

Steve.

carl 04 January 2002 04:14 PM

I agree with steven -- ZIP has the advantage that you can answer the overwrite question with 'none' and it won't prompt again.

ChristianR 04 January 2002 04:28 PM

in the batch file.. i.e.

copy base1\dir1\*.* to base2\dir1\ < n.key


in n.key have
"n

"

but take out the """ :) make sure u have an enter after
then if prompted, it would reply no - but alas, only once.. but work on it :)

i usually have it with a y, and on a logon script when i want something to be over-writted... easier aslo, as it works on dos/win9x clients;)

stevencotton 04 January 2002 04:39 PM

So does pkzip :)

orbv 04 January 2002 06:34 PM


for x in * ; do
if [ -f "path/$x" ]; then
cp $x path/$x
fi
done

Easy (with unix) :D

stevencotton 05 January 2002 08:12 AM

cp -i perhaps, but you can still do it in one line (of less than 80 chars ;)

dsmith 05 January 2002 08:34 AM

Thanks Orb ;) I was personally surprised it took 10 posts b4 someone told me to use unix.

Unfortunately I *know* its better but it would still take me 3 times as long to do the same jobs on Linux 'cos I keep having to use google to find out where the next obscure config file is ;)

Deano

Miles 06 January 2002 11:48 PM

Use robocopy from the NT resource kit - much easier.

carl 01 April 2002 02:15 PM

xcopy /? gives:

/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.

This is on Win98SE though...

Edited to say I'm not sure this is what you want to do. If you only want to copy 'new files' can't you do xcopy \source\*.* destination and then type 'n' at the 'overwrite files' prompt?

[Edited by carl - 1/4/2002 3:16:59 PM]


All times are GMT +1. The time now is 01:59 AM.


© 2024 MH Sub I, LLC dba Internet Brands