Questions regarding copying files from one place to another

learn more… | top users | synonyms

5
votes
3answers
589 views

Duplicate file x times in command shell

I try to duplicate a video file x times from the command line by using a for loop, I've tried it like this, but it does not work: for i in {1..100}; do cp test.ogg echo "test$1.ogg"; done
1
vote
1answer
29 views

parallel file copy using tee unexpectedly slow

we're copying a large zfs snapshot (zfs send) from site-1 to site-2. site-1 and site-2 are remote, and are connected via IPsec (read: slow) on site-2, we need the data on two different zfs servers. ...
3
votes
1answer
41 views

Right click menu in Nemo missing 'create shortcut' and 'copy/move to'

I recently did a clean install of Linux Mint 17.3 with Cinnamon on my machine. Before the clean install, if I right clicked on a file or folder in nemo, the menu would have a 'create shortcut' option....
3
votes
4answers
844 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
3answers
41 views

rename(1)-like script in Perl, but for copying files?

So there's this rename(1) Perl thing. It suits my task precisely, except that I need it to basically cp files instead of mv. How to achieve that? I have quite a few rules of renaming, all expressed ...
1
vote
0answers
67 views

Copying files to a directory shared via ACL doesn't get default mask

I'm trying to setup a simple shared directory on an ext4 filesystem for a group of users to work on. Let's say I just need to give all permissions to all users belonging to the group "workgroup" to ...
5
votes
1answer
10k views

rsync all directories that start with a specific digit

I have directory loaded with thousands of sub directories: /home/tmp/ 1 12 123 1234 2345 234 3456 345 34 ...
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 ...
1
vote
1answer
27 views

Can I clone a larger disk with lots of free space into a smaller disk

Is it possible to clone an OS disk with all its partitions into a smaller disk. The original disk has a lot of free space and the total used space is much smaller than the capacity of the new disk I ...
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/ ap/...
-1
votes
1answer
33 views

How can I successfuly port W10 files to Ubuntu? [closed]

I just installed Ubuntu (Dual boot with W10) and I can see my W10 partition from inside Ubuntu with all my files. They seem fairly corrupt on the Linux side (Text editors, web browsers, Steam etc) ...
2
votes
2answers
92 views

Change directory without using 'cd' [closed]

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. `host1:/base1/...
33
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
6k 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
28 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
22 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 /...
11
votes
5answers
10k 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
32 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 ...
24
votes
3answers
19k 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 16-...
1
vote
2answers
683 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
62 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 ...
-1
votes
1answer
60 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
49 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
36 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
49 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
20k 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
101 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
41 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
58 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
32 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
47 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
63 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
29 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
24 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
29k 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
32 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
277 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
54 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
67 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
38 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
318 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. ...
22
votes
4answers
26k 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
91 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
74 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 ...
2
votes
2answers
70 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
22 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
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 ...