cp - Command-line tool to copy a file

learn more… | top users | synonyms

3
votes
3answers
81 views

Can I forbid the creation of files with certain permissions?

I have a directory with a certain group ID, and I only want files with the same ID to be in that directory. So I set the SGID bit on that directory, so that everytime a file is created inside it, it ...
4
votes
2answers
1k views

How to test which files will be copied with the cp command?

I'm creating a simple script that copies all files from DIRECTORYA that do not exist in DIRECTORYB. I'm doing this through the use of the cp command: cp -u DIRECTORYA/* DIRECTORYB What I'd like to ...
2
votes
1answer
142 views

exec cp failes from script, yet works when issued directly

I have a script that copies SQL backups to a windows server. Here's the line from /etc/fstab: //my.win.box/share$ /winshare cifs credentials=/etc/credfile,dom=mydomain,uid=0,gid=0,file_mode=...
2
votes
1answer
555 views

Can I get the backup option of cp and mv to work with directories?

--backup[=CONTROL] make a backup of each existing destination file The man page does say that it works on file. It doesn't seem to have any effect on directories. Is there anyway to make this ...
1
vote
1answer
214 views

cp with interactive don't prompt before overwrite

I observed a strange behavior cp. Exactly the point is that cp did not ask me for confirmation, even with the option interactive. A test case looks like this Existing files find * -type f app/file....
1
vote
1answer
280 views

Linux command to copy as hard links, while deleting unwanted files?

I'm looking for a command that behaves both like cp -al in only creating hard links rather than copying file contents, and rsync -a --delete in removing files from the destination that are not ...
1
vote
1answer
723 views

How do I force move something when sudo mv -f doesn't work?

I need to move a 16 GB folder to my external drive, but moving it manually gives me an in use error. I have tried to start in safe mode and moved it but it was still in use. I have run these commands ...
0
votes
1answer
372 views

Cp with full renamed path in execl c program

I need to copy file and rename it in execl function so i did: if ( fileExists(new_dest) ){ /*function in which i rename the file by gtk dialog*/ renameDialog(fileName); printf("%s\n",...
0
votes
1answer
87 views

Cron to find exec cp and redirect output with time / date per line?

I try to setup a cron task to run a set of basic shell commands. I need to look to any files created on the last day, then copy to another folder and generate a log stating, line by line, the date ...
0
votes
1answer
43 views

FreeBSD 9.3 and OSX color tags

I am using nas4Free 9.3.2 and FreeBSD 9.3-RELEASE-p22. I noticed after using cp, that my moved files no longer had the color coded labels I had applied in OSX. Share mounted in AFP. To test this, I ...
0
votes
1answer
341 views

? appended to filename while copying from a ssh

I am using the command cp error.log error$HOSTNAME.log the command works properly while running it separately in a server, but if it is run as script which uses ssh I am getting a ? appended to the ...
0
votes
1answer
185 views

How use `rsync -R` with multiple subdirs or install -D with multiple files?

Is possible with rsync to copy multiple files from a source directory to a dest directory with multiple subdirectories that don't exist? Or use install -D with multiples files to a directory that ...
-1
votes
1answer
23 views

Copy Month wise folders

Main_Dir | --------------------------------------------------------------------- Subdir1 Subdir2 Subdir3 ...
-3
votes
1answer
89 views

How to copy a sub directory of one directory to another?

How can I copy a directory structure named function under Dept2 directory into Dept3 directory in one shot?
2
votes
0answers
154 views

Copy file if no error was encountered, else delete copied portion

I am copying a folder in Linux with plenty of files. Some of the files give me errors like this: Error splicing file: Input/output error The problem is that it keeps the file in the new location ...
1
vote
0answers
29 views

Copies to NFS server write to mount point, not to mounted drive

I have a drive mounted at /home/ftpuser/uploads, and the /home/ftpuser folder is also exported via NFS. FTP uploads to the uploads folder work as intended. If I unmount the drive, the files disappear, ...
1
vote
0answers
71 views

Live OS freezes while copying files

I was trying to backup many files (~10,000) from a hard drive on an OS-less notebook to an external 500 GB HDD, so I booted up the Fedora 22 Live XFCE spin using a USB, started the copy and after 5 ...
1
vote
0answers
683 views

Can't make a copy of /var/lib/mysql/ibdata1

I have a RedHat Linux server and I'm trying to make a copy of /var/lib/mysql/ibdata1, but I'm receiving an error saying permission denied and the file cannot be opened. I'm logged in as root user and ...
0
votes
0answers
39 views

`cp -iprv` from UFS to NTFS panics FreeBSD and reboots

My nas4free OS seems to be dead, so I mounted its 2GB UFS data partition on my FreeBSD machine, and my 1TB external USB NTFS HDD (using ntfs-3g /source /mnt/dest). I tried the casual cp -iprv /SOURCE /...
0
votes
0answers
27 views

How to be certain “cp -n -r /dir/ /des/” does not overwrite files.. and is doing its job ? verbose mode?

I run the command cp -n -r /dir/ /backup/ but there is no way to tell what it is doing.. if it is skipping files that already exists.. if it is doing anything.. I tried adding -v option to ...