Questions regarding copying files from one place to another

learn more… | top users | synonyms

2
votes
2answers
81 views

Change directory without using 'cd' [on hold]

I have a list of files with their paths in a text file. And I want to copy these files, mentioned in list, to another directory with their parent folders tree. Also my shell-script to copy these files ...
1
vote
0answers
20 views

Copy directory tree, changing the target of absolute symbolic links

I wondered if there's an easy way to copy, scp, pipe tar, etc. host1:/base1/dir1 to host2:/base2/dir1. Other than the base directory, all the directory structure should be identical. ...
32
votes
2answers
3k views

Why use install rather than cp and mkdir?

I've seen in many places used install -d to create directories and install -c to copy a file. Why not use mkdir and cp? Is there an advantage in using install?
5
votes
5answers
5k views

How can I copy a file in a bash script and rename it while copying and place it in the same directory

How would I copy a file "file.doc" and rename it while copying to "file_copy.doc" and place it in the same directory ? And this only by calling the script and adding the file name in the argument: ...
1
vote
1answer
23 views

Is there any ways to copy all file to one specific sub-folder under the same parent-folder? [duplicate]

So for example i have one folder called "test". Inside that folder, i created one another folder called "player" and a lot of text file, let's say 50 files. [root@ip-10-0-7-70 test]# ls kaka.txt ...
3
votes
1answer
20 views

how do I exclude a specific folder on the destination when using rsync?

consider the following example: /source /source/folder1 /source/folder2 /source/folder3 /destination /destination/folder2 /destination/folder3 /destination/folder3/mytestfolder1 ...
4
votes
2answers
862 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 ...
11
votes
5answers
9k views

How do you compare two folders and copy the difference to a third folder?

You've got three folders: folder current, which contains your current files folder old, which contains an older version of the same files folder difference, which is just an empty folder How do ...
1
vote
0answers
28 views

PSCP - why can't it find the file when using non-admin credentials?

I am trying to make a batch script to get files from Windows vm to Ubuntu vm so I decided to use pscp. when I put pscp -l admin -pw pswd C:\path admin@IP:/path the files transfer fine but I don't ...
23
votes
3answers
18k views

Why is my PC freezing while I'm copying a file to a pendrive?

I have a really strange situation here. My PC works fine, at least in most cases, but there's one thing that I can't deal with. When I try to copy a file from my pendrive, everything is ok -- I got ...
1
vote
2answers
637 views

How use minimum number of commands to copy all .txt files from all subdirectories to one directory?

I have more than 90 subdirectories and inside each one, there will be a number of .txt files. What I need to do is to copy all those txt files out to one single directory. How can I do that?
2
votes
2answers
50 views

How to verify a file copy is reflink/CoW?

I'm playing with btrfs, which allows cp --reflink to copy-on-write. Other programs, such as lxc-clone, may use this feature as well. My question is, how to tell if a file is a CoW of another? Like for ...
2
votes
1answer
2k views

rsync specific directories

Below are the directories of my directory structure. I only want to run rsync on the content under the archive directory of any subdirectory and exclude everything else: ./ ap/ ap/aploader/ ...
-1
votes
1answer
37 views

Transfer files from linux (of linuxdeploy in android) to android (in which linuxdeploy is installed)

I am using Linux on my Android phone via use of Linux deploy. I have some files in /root/android/ - folder of that linux partition. And I want one of those files to move to my /storage/sdcard1/ - ...
3
votes
1answer
32 views

reserve disk space before copying files

I would like to reserve (or is the keyword "claim"?) some amount of disk space before an rsync occurs so other programs will believe a disk has less space (because after the rsync, the disk will have ...
-1
votes
1answer
32 views

How to copy all images from disk to single directory using mc

I have very messy disk with many images in many folders. How I could copy only all files with .jpg extension to another disk into single directory? Probably there are many images with same name but I ...
2
votes
0answers
38 views

Linux usb-drive write cache

Is there any way to change the way the Linux kernel handles external storage and the external storage cache? Every time I copy something to it, the copy process seen from userspace seems really fast. ...
2
votes
2answers
19k views

Java code to copy files from one linux machine to another linux machine

I'm looking for java code to copy files to a remote linux system. I have tried Runtime.getRuntime().exec() function by passing an scp command, but each time I run the program it is asking for the ...
0
votes
1answer
75 views

Filesystem errors when restoring many files

I had an external hard drive that I mounted internally. It came formatted with NTFS, and I wanted to move to ext4. So I copied everything I wanted to keep onto other drives, created a brand new ...
1
vote
2answers
39 views

Copy/move group files with renaming

I want to copy (or move) some files like cp ./patt*.py /other/path. However /other/path/ already contents files with the same names. So, I would like copy with renaming (adding some suffix, for ...
0
votes
1answer
26 views

Copy files if directory does not exist on target

Can you copy files (using rsync ideally but any scriptable tool considered) from server A to server B skipping directories that already exist on the target, and any files they contain? Server A FEED ...
1
vote
2answers
54 views

Copy files from a directory if name present in a text file

#!/bin/bash while IFS='' read -r line || [[ -n "$line" ]]; do cd /home/Sud/Minimal\ Packages/All/ if [ -d $line ] then cp $line*.rpm /home/Sud/NewFolder/rpms/ else ...
-2
votes
1answer
31 views

Copying files from multiple directories [closed]

I want to copy a single file from 10 different directories and append them in another directory.
0
votes
1answer
43 views

Using --delete option with rsync

We are using the following rsync command in a script to copy files from source to destination. rsync -av --exclude 'share/web/sessions/' --rsync-path "sudo rsync" /sdata/ 172.31.X.X:/sdata/ ...
1
vote
1answer
50 views

How to copy files from one directory to another so that only new files are copied? [duplicate]

How would it be possible to copy all new contents from one directory to another so that only new files are copied from the source directory (both directories have the same naming tree). For example, ...
1
vote
1answer
22 views

How to clone an entire disk to a larger disk and then offload?

The title might be a bit confusing, so in detail: What I have done is clone a small 32GB flash module that had three partitions. I happened to have a 32GB USB lying around, so I thought it might just ...
0
votes
1answer
21 views

attempting to create a script, with an alias, that will backup a single file

I want to do this. I want to create an alias called 'bu' (backup). The bu alias would call upon the copy tool to copy any file passed to a directory I will manually setup in /root/backup/ $bu ...
4
votes
1answer
28k views

Copy multiple files into one (append, merge) in single invocation without shell redirection?

I'm looking for some sort of a command that I can use, to copy/append multiple files into one; but without shell redirection (I'd like to try it in call_usermodehelper, see similar issue in ...
0
votes
1answer
29 views

Can't copy to usb device

Changed /etc/fstab /dev/sdc1 /media/usb rw,noatime,user,umask=0 0 0 Mounted mount -a But while copying showed Operation not permitted
5
votes
3answers
258 views

Watch /tmp for file creation and prevent deletion of files? [duplicate]

I have a binary that creates some files in /tmp/*some folder* and runs them. This same binary deletes these files right after running them. Is there any way to intercept these files? I can't make the ...
-4
votes
1answer
44 views

linux error flag in permission denied thing [closed]

Even after running the command sudo chmod -R 777 /home, I cannot fix the error: Sorry, user kumarht1 is not allowed to execute '/bin/chmod -R 777 /kumarht1' as root on host.com. How should I fix ...
3
votes
2answers
54 views

How to copy modified files while preserving folder structure

I have made many changes to files in my PHP project and I want to push those changes to our server via FileZilla FTP. Rather than push all of the files, I would like to find only the files that have ...
0
votes
2answers
36 views

Copy last used files of total size

I want to copy the last used (or maybe created) files of a total size to another folder. Is this possible without additional tools? I have an USB drive of a certain size that is less than the total ...
4
votes
3answers
248 views

Copy only certain file types from a folder structure to another

I have a top folder with many sub-folders. It's named "a". There are many .png and .jpg files in there. I'd like to recursively copy "a" into a new folder "b", but only copy the .png and .jpg files. ...
19
votes
4answers
24k views

How to copy-merge two directories? [duplicate]

I have two directories images and images2 with this structure in Linux: /images/ad /images/fe /images/foo ... and other 4000 folders and the other is like: /images2/ad /images2/fe ...
0
votes
1answer
75 views

rsync failing to exclude directory [duplicate]

We are using rsync to copy files from one location to another location on a different host. We want to exclude a directory from the source location so that files from this directory are not copied . ...
-5
votes
2answers
66 views

Copying file from one directory to another directory [closed]

So I have this directory called CS under my home directory. Under CS, I have 3 directories called "Q", "W", "E". I want to copy a file in "Q" into "W", but I'm having trouble. I tried numerous cp ...
3
votes
4answers
783 views

Copy All Files With Certain Length File Name

In directory /source I'd like to copy all files with a file name more than 15 characters to directory /dest. Is there a UNIX command to do this? EDIT: Although this question explains how to search ...
2
votes
2answers
69 views

How to duplicate a file a number of times while embedding an index in each file

I have a file named, for example, ascdrgi.txt, with the following contents: tiger lion cat I want to duplicate this file a (variable) number of times by changing the last character of the filename ...
1
vote
0answers
21 views

Search drive and copy source to flat target

I have backups and backups of backups (there are copies of copies) of images spread out over various drives. I want to scan the drives and copy all images from a source to one flat target directory. I ...
2
votes
0answers
152 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 ...
10
votes
1answer
127 views

How to duplicate a file without copying its data with btrfs?

I have no experience with btrfs, but it's advertised to be able to de-duplicate files. In my application, I'd need to duplicate whole directory trees. From what I learned, btrfs only de-duplicates ...
32
votes
7answers
3k views

Is it a UUOC (useless use of cat) to redirect one file to another?

If I want to make the contents of file2 match the contents of file1, I could obviously just run cp file1 file2. However, if I want to preserve everything about file2 except the contents—owner, ...
16
votes
8answers
9k views

How do I copy all files and directories except certain ones over ssh?

Using the Linux command line, I use the scp command to copy up all the files and folders from a certain directory. However, I don't like to consume wasted bandwidth for copying up things I rarely ...
1
vote
1answer
23 views

ZeroCopy using commandline

Does any of the standard copy mechanisms take advantage of zero copy? Ex. cp, rsync
30
votes
11answers
40k views

Is there a faster alternative to cp for copying large files (~20 GB)?

I am a graduate student, and the group in which I work maintains a Linux cluster. Each node of the cluster has its own local disk, but these local disks are relatively small and are not equipped with ...
1
vote
1answer
46 views

copying and working on OSX .app files (folders) in linux

tldr; I want to run a script over an external hard drive and tar.gz every folder that ends with .app into their own archive. That is, I don't want them all in one tar.gz file, I want to create one ...
1
vote
2answers
260 views

See progress in Files (Nautilus)

I am trying to copy a directory containing multiple subdirectories and files to an external drive. It is taking a long time (24+ hours). I copied in Files on Fedora 23 instead of cp -v on the ...
1
vote
3answers
440 views

How to copy symlinks as symlinks from one machine to another?

Let's assume I have two identical systems. On the first system I've created a symbolic link. On the second one I want to copy that symlink via sftp and the symlink shall work the same (i.e if the ...