Questions regarding copying files from one place to another

learn more… | top users | synonyms

0
votes
0answers
38 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 ...
4
votes
5answers
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 ...
0
votes
1answer
34 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
29 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 ...
8
votes
2answers
2k views

How to sync two folders with command line tools?

Having migrated to Linux from Windows, I would like to find an alternative software to Winmerge or rather learn command line tools to compare and sync two folders on Linux. I would be grateful if you ...
0
votes
1answer
133 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 ...
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
34 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 ...
6
votes
3answers
636 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
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. ...
3
votes
1answer
78 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
900 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
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
0answers
70 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
11k 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 ...
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 ...
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
93 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/...
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
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 /...
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
42 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
20k 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
742 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
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 ...
-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/ - ...
3
votes
1answer
57 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
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. ...
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 ...
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
60 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
80 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 ...
4
votes
1answer
30k 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
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
293 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 ...