Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cp(1) [bsd man page]

CP(1)							      General Commands Manual							     CP(1)

NAME
cp - copy SYNOPSIS
cp [ -ip ] file1 file2 cp [ -ipr ] file ... directory DESCRIPTION
File1 is copied onto file2. By default, the mode and owner of file2 are preserved if it already existed; otherwise the mode of the source file modified by the current umask(2) is used. The -p option causes cp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the present umask. In the second form, one or more files are copied into the directory with their original file-names. Cp refuses to copy a file onto itself. If the -i option is specified, cp will prompt the user with the name of the file whenever the copy will cause an old file to be overwrit- ten. An answer of 'y' will cause cp to continue. Any other answer will prevent it from overwriting the file. If the -r option is specified and any of the source files are directories, cp copies each subtree rooted at that name; in this case the destination must be a directory. SEE ALSO
cat(1), mv(1), rcp(1C) 4th Berkeley Distribution June 8, 1985 CP(1)

Check Out this Related Man Page

RCP(1)							    BSD General Commands Manual 						    RCP(1)

NAME
rcp -- remote file copy SYNOPSIS
rcp [-px] file1 file2 rcp [-px] [-r] file ... directory DESCRIPTION
Rcp copies files between machines. Each file or directory argument is either a remote file name of the form ``rname@rhost:path'', or a local file name (containing no `:' characters, or a `/' before any `:'s). -r If any of the source files are directories, rcp copies each subtree rooted at that name; in this case the destination must be a direc- tory. -p The -p option causes rcp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignor- ing the umask. By default, the mode and owner of file2 are preserved if it already existed; otherwise the mode of the source file mod- ified by the umask(2) on the destination host is used. If path is not a full path name, it is interpreted relative to the login directory of the specified user ruser on rhost, or your current user name if no other remote user name is specified. A path on a remote host may be quoted (using , ", or ') so that the metacharacters are interpreted remotely. Rcp does not prompt for passwords; it performs remote execution via rsh(1), and requires the same authorization. Rcp handles third party copies, where neither source nor target files are on the current machine. SEE ALSO
cp(1), ftp(1), rsh(1), rlogin(1) HISTORY
The rcp command appeared in 4.2BSD. BUGS
Doesn't detect all cases where the target of a copy might be a file in cases where only a directory should be legal. Is confused by any output generated by commands in a .login, .profile, or .cshrc file on the remote host. The destination user and hostname may have to be specified as ``rhost.rname'' when the destination machine is running the 4.2BSD version of rcp. Linux NetKit (0.17) August 15, 1999 Linux NetKit (0.17)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Lots of file copyingand renaming?

I have Approx 1000 files that all need to be copied from one directory to another. However, each file has to be renamed while it is copied. I have a Tab delimited text file containing all of the old and new file names (they are not all the same character length). Is there a way to read in the... (12 Replies)
Discussion started by: AeroEngy
12 Replies

2. Programming

recursive copy of the directory

I want to copy a directory recursively ( it again has directories) and the directory is on windows and is nfsmounted in vxWorks, i am using unix to develop the code for this, can any one suggest me how to copy the directories recursively. (7 Replies)
Discussion started by: deepthi.s
7 Replies

3. Shell Programming and Scripting

Joining two files based on columns/fields

I've got two files, File1 and File2 File 1 has got combination of col1, col2 and col3 which comes on file2 as well, file2 does not get col4. Now based on col1, col2 and col3, I would like to get col4 from file1 and all the columns from file2 in a new file Any ideas? File1 ------ Col1 col2... (11 Replies)
Discussion started by: rudoraj
11 Replies

4. Shell Programming and Scripting

Finding PID of a process using variable substituition

Hi All, Am copying mulitple files in a directory in names File0,File1,File2 etc. I need to print separately the PID of these copies using File names. for((i=0;i<5;i++)) do mypid=`ps aux | awk '/File$i/ && !/awk/ { print $2 }'` echo PID is $mypid done It printed nothing. Thinking... (6 Replies)
Discussion started by: amio
6 Replies

5. Shell Programming and Scripting

Read each word from File1 and search each file in file2

file1: has all words to be searched. 100007 200999 299997 File2: has all file names to be searched. C:\search1.txt C:\search2.txt C:\search3.txt C:\search4.txt Outfile: should have all found lines. Logic: Read each word in file1 and search each file in the list of File2; if the... (8 Replies)
Discussion started by: clem2610
8 Replies

6. HP-UX

Copy only files whiich do not exist on Target Directory

Hi, I am using HP-UX B 11.23 I want to copy files from one directory into another directory in such a way that, only the nonexistent files in target directory are copied from source directory e.g. dir1 has file1 file2 file3 dir2 has file1 file3 now I want that a command... (7 Replies)
Discussion started by: Chetanaz
7 Replies

7. UNIX for Dummies Questions & Answers

copy files

Hi Team, I am unable to copy the files, when i run the below script, i am getting error as file not present, not sure what i am missing. # File to be looked upon File_Pattern='*.zip' TMP_FILE=flagfile Check=`find $Directorypath -name $File_Pattern -type f -newer $TMP_FILE -print |... (6 Replies)
Discussion started by: Naveen_5960
6 Replies

8. UNIX for Dummies Questions & Answers

How to copy a file to a directory?

Hello all, I've been researching this problem for days, and have gotten no luck . =/ How do you copy a file to another directory without being in the same directory as the file? So, for example, say I wanted to copy the file 'my.txt' that is in the directory ' /export/hom0/user/asdf ' to the... (9 Replies)
Discussion started by: kvnqiu
9 Replies

9. UNIX for Dummies Questions & Answers

How to copy a tree of directory

Mi question is how can you copy only de three of directory and not the files in it. Only a need the three of directorys not the files (6 Replies)
Discussion started by: enkei17
6 Replies

10. Shell Programming and Scripting

search for matching value between lists

Hello. I have two very large files, file1 and file2. File1 has two columns of paired numbers eg. 2 5 9 17 47 700 File1 has one column of numbers eg. 5 7 76 I would like to search in file2 for numbers that are greater than or equal to... (6 Replies)
Discussion started by: godzilla07
6 Replies

11. Shell Programming and Scripting

Validating uppercase/lowercase of user input with perl compared to unix folders

Hi, I need to copy files from a source directory to a destination directory in unix. I'm using the file::copy for the actual copy. The problem is that the source and dest directories are supplied by different users, who might type the name of the directories in various combinations of lower... (6 Replies)
Discussion started by: Furou
6 Replies

12. Shell Programming and Scripting

pasting two files in every directory (+100 directories)

Hi, I have around 400 directories each one named as hour_1/ , hour_2/ .....hour_400/ and each of these contains two files, namely: File1: hour_1.txt (in hour_1/) , hour_2.txt (in hour_2/) ....hour_400.txt (in hour_400/) etc... File2: client_list_hour_1.txt (in hour_1/),... (7 Replies)
Discussion started by: amarn
7 Replies

13. Solaris

sync directories without ssh

Developers write application programs in a directory say /oraas/testappl. Once they complete testing they copy application files to /oraas/liveappl. I would like to do:- As soon as any file is copied to /oraas/liveappl, I would like to copy the same file to /oraas/liveappl on another server.... (6 Replies)
Discussion started by: mubeenmd
6 Replies

14. Shell Programming and Scripting

Inserting file after specific line in another file

Im attempting to insert the contents of File1 at a specific point of File2. File1 AD004 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 File2 AA001 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 AB002 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 AC003 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 Result AA001 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1... (13 Replies)
Discussion started by: ncwxpanther
13 Replies

15. Shell Programming and Scripting

How to deal with replaced files?

My task is to copy all files from many directories in one. The big problem i encounter is that some files in different directory have the same names. Is they are way to copy the files that have same names in a sub directory ( need to preserve the name of the files unchanged ) I have list with... (6 Replies)
Discussion started by: gogok_bg
6 Replies