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 |
Doh ! - Its Win2K btw :)
|
|
/-Y Causes prompting to confirm you want to overwrite an existing destination file.
|
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. |
Zip the directories up then unzip them at their destination.
Steve. |
I agree with steven -- ZIP has the advantage that you can answer the overwrite question with 'none' and it won't prompt again.
|
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;) |
So does pkzip :)
|
for x in * ; do if [ -f "path/$x" ]; then cp $x path/$x fi done Easy (with unix) :D |
cp -i perhaps, but you can still do it in one line (of less than 80 chars ;)
|
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 |
Use robocopy from the NT resource kit - much easier.
|
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