Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

xcopy question

Thread Tools
 
Search this Thread
 
Old 04 January 2002, 02:58 PM
  #1  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Question

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
Old 04 January 2002, 02:59 PM
  #2  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

Doh ! - Its Win2K btw
Old 04 January 2002, 03:07 PM
  #3  
ChrisB
Moderator
 
ChrisB's Avatar
 
Join Date: Dec 1998
Location: Staffs
Posts: 23,573
Likes: 0
Received 0 Likes on 0 Posts
Post

Must be a switch for that in XXCopy.

http://www.xxcopy.com/
Old 04 January 2002, 03:32 PM
  #4  
netclectic2
Scooby Regular
 
netclectic2's Avatar
 
Join Date: Mar 2001
Posts: 218
Likes: 0
Received 0 Likes on 0 Posts
Post

/-Y Causes prompting to confirm you want to overwrite an existing destination file.
Old 04 January 2002, 03:57 PM
  #5  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

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.
Old 04 January 2002, 04:01 PM
  #6  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Zip the directories up then unzip them at their destination.

Steve.
Old 04 January 2002, 04:14 PM
  #7  
carl
Scooby Regular
 
carl's Avatar
 
Join Date: May 1999
Posts: 7,901
Likes: 0
Received 0 Likes on 0 Posts
Post

I agree with steven -- ZIP has the advantage that you can answer the overwrite question with 'none' and it won't prompt again.
Old 04 January 2002, 04:28 PM
  #8  
ChristianR
Scooby Regular
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Post

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
Old 04 January 2002, 04:39 PM
  #9  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

So does pkzip
Old 04 January 2002, 06:34 PM
  #10  
orbv
Scooby Regular
 
orbv's Avatar
 
Join Date: Apr 2001
Location: Hants
Posts: 1,103
Likes: 0
Received 0 Likes on 0 Posts
Post


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

Easy (with unix)
Old 05 January 2002, 08:12 AM
  #11  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

cp -i perhaps, but you can still do it in one line (of less than 80 chars
Old 05 January 2002, 08:34 AM
  #12  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 06 January 2002, 11:48 PM
  #13  
Miles
Scooby Regular
 
Miles's Avatar
 
Join Date: Oct 1998
Location: The Granite City/Dallas, Tx.
Posts: 2,519
Likes: 0
Received 0 Likes on 0 Posts
Post

Use robocopy from the NT resource kit - much easier.
Old 01 April 2002, 02:15 PM
  #14  
carl
Scooby Regular
 
carl's Avatar
 
Join Date: May 1999
Posts: 7,901
Likes: 0
Received 0 Likes on 0 Posts
Post

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]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
slimwiltaz
General Technical
20
09 October 2015 07:40 PM
IanG1983
Wheels, Tyres & Brakes
2
06 October 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM
the shreksta
Other Marques
26
01 October 2015 02:30 PM



Quick Reply: xcopy question



All times are GMT +1. The time now is 09:37 PM.