The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
option followed by : taking next option if argument missing with getopts gurukottur Shell Programming and Scripting 2 03-17-2008 12:46 PM
-n option ravi raj kumar Shell Programming and Scripting 1 01-03-2008 09:20 AM
what is gcc -e option in C useless79 High Level Programming 3 12-05-2007 01:36 PM
su option lesstjm UNIX for Advanced & Expert Users 1 11-02-2005 01:54 PM
-h option Raom UNIX for Advanced & Expert Users 1 10-26-2005 02:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-18-2006
td_kuoj3 td_kuoj3 is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 2
cp - no to all option?

Hi,

Is there a no to all option when copying a bunch of files? instead of pressing enter endlessly.

Thanks
  #2 (permalink)  
Old 08-18-2006
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
What OS and version are you using? What is the exact command?

On Solaris, if I run the following it does not cause me to hit return for each file.

$ cp ./dirone/*.* ./dirtwo/

If I then change it to interactive mode, I have to hit y and return for each file I want to overwrite

$ cp -i ./dirone/*.* ./dirtwo/

There are no options which would cause me to have to hit return for each file unless you mean you are doing each file individually (which means you should use a wildcard character such as * to give yourself less 'returns').

Last edited by RTM; 08-18-2006 at 03:34 PM..
  #3 (permalink)  
Old 08-18-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
Probably the OP has an alias set up for him like alias cp='cp -i'
  #4 (permalink)  
Old 08-18-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
... or he/she/it [the OP that is] has permission issues on the 'destination' file/directory.
  #5 (permalink)  
Old 08-18-2006
td_kuoj3 td_kuoj3 is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 2
OS: AIX 5.3

Let me restate my problem again.

i want to copy dirone to dirtwo, they're similiar, but there are some extra files in dirone that dirtwo doesn't have, going through them one by one takes way too long. So I use the following command to copy one directory to the second.

cp -R -h -i /dirone/* /dirtwo

I wanted -i in there because I do NOT want to overwrite, the directory is huge and i had to sit here pressing enter for 1.5 hours.

Now my question is, is there an option that is "no to all"?

Thanks, any help is much appreciated.
  #6 (permalink)  
Old 08-18-2006
tansha tansha is offline
Registered User
  
 

Join Date: May 2006
Posts: 23
Hi ,

I would instead use a simple script like the one below to achieve same.

Hope this helps.




#! /bin/ksh

export SRC_DIR=/YOUR/SOURCE/DIRECTORY
export TGT_DIR=/YOUR/TARGET/DIRECTORY

for i in `ls $SRC_DIR`
do
echo $i

if [ -f $TGT_DIR/$i ]
then
echo " File exists - will not overwrite it !!!"
else
echo " File $i is not present on target directory - copying same"
cp $SRC_DIR/$i $TGT_DIR/$i
fi
done
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0