Sponsored Content
Full Discussion: cp - no to all option?
Top Forums UNIX for Dummies Questions & Answers cp - no to all option? Post 302085654 by tansha on Friday 18th of August 2006 03:09:33 PM
Old 08-18-2006
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
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

-h option

Hi what does the following mean in shell scripts (-h option) val contains a string. while (-h "$val") (1 Reply)
Discussion started by: Raom
1 Replies

2. UNIX for Advanced & Expert Users

su option

We have started to us the su option on our production server. We log in with our own id and then su into a special id to perform various tasks. This allows our actions to be monitored. I need to know how to use the su option when doing an ftp between two servers. I noticed that when I log into... (1 Reply)
Discussion started by: lesstjm
1 Replies

3. Programming

cc option

my yacc output file y.tab.c is not compiling using cc y.tab.c -ly command .possibily option flag -ly is not correct.i m using red hat linux 9.please give solutions. (4 Replies)
Discussion started by: kuldeep_bora
4 Replies

4. Shell Programming and Scripting

which is best searching option

Hi, I need one help for choosing best option among sed, perl and awk. I need to search and replace thousand files for a text and need to replace it. I am in confusion for choosing the option for best results. Because by using sed option its taking too much time for searching and replacing... (3 Replies)
Discussion started by: dbsurf
3 Replies

5. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

6. Programming

g++ and the -R option

hi everybody, can somebody tell me what -R option on g++ on solaris means : g++ -DAIX -fpic -static -o printps printps.o -L/epost2/blitz/xercesc1_1 /lib -L/oracle/OraHome/lib32/ L/epost2/blitz/lib -lxerces-c1_1 -lhmltods -lhmlt ops -lgeneric -lnotify -lutil -lclntsh `cat... (0 Replies)
Discussion started by: eternalflame
0 Replies

7. Shell Programming and Scripting

Can there be a better option?

Hello, I am still in the process of learning Shell Programming. The online manual, that I am referring to had following question: I made a script as follows: df --block-size=1GB | tr -s ' '| cut -d' ' -f2,5 | grep -v 1GB* | sort -k1,2n | tail -1 | cut -d' ' -f2 | cut -d '%' -f1 and it... (2 Replies)
Discussion started by: shahdharmit
2 Replies

8. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

9. Shell Programming and Scripting

-f option and -rf in rm

Hi, I'm new to shell scripting and I'm trying to read some code I need to use. Could you help me out on what it's doing? I read this as.... if the directory has files then rm all the files in that directory. I'm not sure.... if ; then run "rm -rf ${TSP_FILEPATH_PLUGIN_DIR}"; fi run... (8 Replies)
Discussion started by: jdilts
8 Replies

10. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies
CP(1)									FSF								     CP(1)

NAME
cp - copy files and directories SYNOPSIS
cp [OPTION]... SOURCE DEST cp [OPTION]... SOURCE... DIRECTORY cp [OPTION]... --target-directory=DIRECTORY SOURCE... DESCRIPTION
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. -a, --archive same as -dpR --backup[=CONTROL] make a backup of each existing destination file -b like --backup but does not accept an argument --copy-contents copy contents of special files when recursive -d same as --no-dereference --preserve=link --no-dereference never follow symbolic links -f, --force if an existing destination file cannot be opened, remove it and try again -i, --interactive prompt before overwrite -H follow command-line symbolic links -l, --link link files instead of copying -L, --dereference always follow symbolic links -p same as --preserve=mode,ownership,timestamps --preserve[=ATTR_LIST] preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: links, all --no-preserve=ATTR_LIST don't preserve the specified attributes --parents append source path to DIRECTORY -P same as `--no-dereference' -R, -r, --recursive copy directories recursively --remove-destination remove each existing destination file before attempting to open it (contrast with --force) --reply={yes,no,query} specify how to handle the prompt about an existing destination file --sparse=WHEN control creation of sparse files --strip-trailing-slashes remove any trailing slashes from each SOURCE argument -s, --symbolic-link make symbolic links instead of copying -S, --suffix=SUFFIX override the usual backup suffix --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY -u, --update copy only when the SOURCE file is newer than the destination file or when the destination file is missing -v, --verbose explain what is being done -x, --one-file-system stay on this file system --help display this help and exit --version output version information and exit By default, sparse SOURCE files are detected by a crude heuristic and the corresponding DEST file is made sparse as well. That is the behavior selected by --sparse=auto. Specify --sparse=always to create a sparse DEST file whenever the SOURCE file contains a long enough sequence of zero bytes. Use --sparse=never to inhibit creation of sparse files. The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values: none, off never make backups (even if --backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups As a special case, cp makes a backup of SOURCE when the force and backup options are given and SOURCE and DEST are the same name for an existing, regular file. AUTHOR
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for cp is maintained as a Texinfo manual. If the info and cp programs are properly installed at your site, the com- mand info cp should give you access to the complete manual. cp (coreutils) 4.5.3 February 2003 CP(1)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy