|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
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 02:34 PM.. |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Probably the OP has an alias set up for him like alias cp='cp -i'
|
|
#4
|
||||
|
||||
|
... or he/she/it [the OP that is] has permission issues on the 'destination' file/directory.
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
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. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
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 |
| Sponsored Links | |
|
|
#7
|
||||
|
||||
|
Use my favorite command of all time: yes Code:
yes n | cp -R -h -i /dirone/* /dirtwo |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
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 11:46 AM |
| -n option | ravi raj kumar | Shell Programming and Scripting | 1 | 01-03-2008 08:20 AM |
| what is gcc -e option in C | useless79 | Programming | 3 | 12-05-2007 12:36 PM |
| su option | lesstjm | UNIX for Advanced & Expert Users | 1 | 11-02-2005 12:54 PM |
| -h option | Raom | UNIX for Advanced & Expert Users | 1 | 10-26-2005 01:19 AM |
|
|