Questions regarding copying files from one place to another

learn more… | top users | synonyms

0
votes
0answers
41 views

What may go wrong while copying file? [on hold]

I am writing a library as part of learning a new language which copies a file. The task is to copy the file content as using the nodejs Stream API. I am interested in knowing what can happen wrong ...
0
votes
1answer
36 views

Capture stdout from ssh session to local machine

I am having to put together a script that will ssh into devices to run a command such as "show running-config" and save the output to a file on my local machine. I have done similar tasks like this ...
0
votes
1answer
24 views

Copy folders has specific part of name and it is content

I have a long list of folder as follow: 001_bat_3513 002_mon_3213 003_bat_3515 004_btt_3540 005_bat_4513 055_bpt_8523 056_bot_3513 058_bat_1513 . . From this list: How can I copy the folders ( and ...
2
votes
2answers
41 views

Can I use the 'cp' command with the -b option, but have it fail if the backup file already exists?

I'd like to use cp -b to copy a file to a destination, possibly creating a backup file of the destination path if it already exists. But, if the backup file already exists, I'd like to have cp fail ...
1
vote
2answers
31 views

Install the content of a folder into another

I'm trying to write a Makefile to install the content of my folder into another on the system. I would like to keep the same directory structure, like this. localfolder ├── a └── b ├── c    ...
2
votes
2answers
30 views

finding a folder names based on list contained in .txt file

I have a .txt file containing 150 different ID number on each line like so: 12345 15876 19643 12586 Located in the same directory as the .txt file, I have 300 folders and I want to copy only the ...
0
votes
1answer
18 views

How do I replace all files in a folder with one file?

I have one file, let's call it image.png. I also have a folder of files like so: picture.png file.png screenshot.png art.png painting.png And so on. What I want to do is replace each file inside ...
3
votes
1answer
35 views

Fit timestamps of multiple files/folders to existing ones

I've copied a large directory to another location (through a network). I needed to preserve all the timestamps (especially ctime and mtime). However somewhere in the process I screwed things up. (I ...
1
vote
1answer
30 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. ...
6
votes
3answers
640 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
3
votes
1answer
81 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....
2
votes
3answers
44 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
1answer
29 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 ...
-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
94 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
21 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/...
1
vote
1answer
29 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
23 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 /...
1
vote
0answers
44 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 ...
3
votes
1answer
58 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
118 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/ - ...
-1
votes
1answer
38 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
66 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. ...
0
votes
1answer
137 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
44 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
30 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
59 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
33 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
62 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
83 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
31 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
26 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 ...
-3
votes
2answers
174 views
0
votes
1answer
35 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
295 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
58 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
75 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 ...
4
votes
3answers
408 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. ...
0
votes
2answers
46 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 ...
2
votes
2answers
75 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 ...
0
votes
1answer
95 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 . ...
3
votes
4answers
902 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
71 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 ...
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, ...
10
votes
1answer
164 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 ...
1
vote
1answer
25 views

ZeroCopy using commandline

Does any of the standard copy mechanisms take advantage of zero copy? Ex. cp, rsync
1
vote
1answer
49 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
3answers
811 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 ...
1
vote
2answers
360 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 terminal....