Command for copying files without


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command for copying files without
# 1  
Old 03-31-2010
Power Command for copying files without

Hi..

I have a file with same name in different locations which i need to copy.

Am trying this
Code:
cp -r /var/lib/text1 /backup

In the /backup i have the same file called text1 so it's prompting for overwrite. Any opinions on how to avoid this prompting and copy files.

Thanks in advance.

Last edited by zaxxon; 03-31-2010 at 10:08 AM.. Reason: code tags
# 2  
Old 03-31-2010
See the "-f" switch to "cp".
This assumes that you have permissions to overwrite the file of that name.
# 3  
Old 03-31-2010
Hi methyl,

I tried the -f option too,but still its prompting.. !!!! I went through the cp --help but no useful information.
# 4  
Old 03-31-2010
I can only guess that you are not the owner of the file you are trying to overwrite?
# 5  
Old 03-31-2010
or cp is aliased....

what is output of

Code:
which cd

?

if so - try specifying complete path e.g.

Code:
/usr/bin/cp ......

# 6  
Old 03-31-2010
Code:
Please post:

ls -lad /var/lib/text1
ls -lad /backup
ls -lad /backup/text1
id


And the actual message you receive from "cp".

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying files

All, I need to grab and rename common files from several unique directory structures. For example, the directory structures looks like: /unique_dir/common/common/common/person_name_dir/common_file.txt There are over 90,000 of these text files that I'd like to put in a single directory as... (5 Replies)
Discussion started by: hburnswell
5 Replies

2. Shell Programming and Scripting

Files copying - [ Listed files alone. ] - Shell script

Hi All, I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files. To Do From Directory : /myproject/MainDir To Directory : /myproject/data List of files need to copy is in the file: /myproject/filesList.txt ... (4 Replies)
Discussion started by: linuxadmin
4 Replies

3. OS X (Apple)

Automated command ; extracting files from folders and copying them into a single folder

Hello everyone, I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me: I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and... (2 Replies)
Discussion started by: qcom
2 Replies

4. UNIX for Advanced & Expert Users

copying of files by userB, dir & files owned by userA

I am userB and have a dir /temp1 This dir is owned by me. How do I recursively copy files from another users's dir userA? I need to preserve the original user who created files, original group information, original create date, mod date etc. I tried cp -pr /home/userA/* . ... (2 Replies)
Discussion started by: Hangman2
2 Replies

5. Shell Programming and Scripting

copying links/files using rsync command

Hi I am using rsync command to copy the likes like bwlow rsync -vaR krish/harris/test data/charles I am running this script in test1 folder but the krish/harssis /test is existed in test2 folder. So when i run this command am getting the error like rsync: link_stat... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

6. Solaris

Copying Files

Hi, I understand that to copy files across server, the feasible way will be using scp command. Am I right? What if the two servers are not connected to a network? If by using a cross cable to link up both the server, what will be the best (fastest) way to copy files across? scp as well? ... (3 Replies)
Discussion started by: user50210
3 Replies

7. Shell Programming and Scripting

copying files

hi I want to copy all files from the current directory and move to .archive file. Moreover,I want to add .bak to each file name, that will be copied. How can I do that? (4 Replies)
Discussion started by: tjay83
4 Replies

8. UNIX for Dummies Questions & Answers

Using cp -r command to selectively omit *.dat files while copying a directory.

Hi all, I want to copy a directory named Ec1 to another directory named Ec2, newly created. But Ec1 has a bunch of *.dat files and many many other kinds of files. Whle creating Ec2, I selectively want to omit the *.dat files since they are huge files of the order of 100 MBs and there are... (5 Replies)
Discussion started by: d_sai_kumar
5 Replies

9. Solaris

Copying Files and

I am new user to solaris and installed solaris operating system on full Harddisk 120Gb. I am unable to copy music files to desktop and /home directory. One thing happened while registering is- i entered login-root and its password. The message prompted your system is crashed. Is it because of... (1 Reply)
Discussion started by: patilmukundraj
1 Replies

10. Shell Programming and Scripting

find command and copying

Trying to write a find command that will be used for incremental backups. Basically find files newer than date, and copy them (directory structures intact) to the backup drive. When I try the following: find / -newer /home/robf/incremental -type f -exec cp -afP {} /backup/inc1 \; It puts all... (1 Reply)
Discussion started by: robf
1 Replies
Login or Register to Ask a Question