Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [file-copy]

Questions regarding copying files from one place to another

4
votes
1answer
254 views

systemd and copy (/bin/cp): no such file or directory

While manually copying the file the following works, as below: userx@x:~$ cp -rv /opt/test-bak/* /opt/test/ '/opt/test-bak/file1' -> '/opt/test/file1' '/opt/test-bak/file2' -> '/opt/test/file2' ...
0
votes
1answer
26 views

Copy files from folders and sub folders without preserving directory structure

I have a folder(A) which is structured like this Main Directory(A) | | Subdir------Subdir2-----Subdir3 | | | | | |...
0
votes
1answer
22 views

Finding files and copy with folder structure intact

I am searching files who have either been created or modified for the last 60 minuts. I find these via find ~/data/ -cmin -60 -mmin -60 -type f ~ the home directory /usr/wg/ After that I want to ...
0
votes
2answers
43 views

Copy folder to multiple (similar) locations simultaneously

I have around 90 websites I need a plugin installed on (wordpress) and I was wondering if there's a way to copy the plugin folder to all of them in a single run (i.e., simultaneously / in parallel).  ...
5
votes
1answer
158 views

In what order does sftp fetch files when using “get -r folder”?

I'm doing a file transfer using sftp. Using the get -r folder command, I'm surprised about the order that the program is downloading the content. It looks like it would be selecting the files it ...
2
votes
4answers
221 views

How to copy the rest of lines of a file to another file [duplicate]

I have the string xyz which is a line in file1.txt, I want to copy all the lines after xyz in file1.txt to a new file file2.txt. How can I achieve this? I know about cat command. But how to specify ...
0
votes
3answers
59 views

How to copy an image from one directory to another in unix?

Okay so for a research project, I am charged with working on a digital video game that happens to be formed by the use of Unix and emacs (don't know if they are the same thing because I just started ...
0
votes
1answer
26 views

Copy or move large file with transient name till the file is completely transfered to destination in linux

I am trying to copy/move a large file (15 GB) to a directory in Linux and want to have a dependency on that event. Now lets say I have a file named abc.txt, and I am running below command: mv /usr/...
0
votes
1answer
36 views

How to resolve btrfs errors? copying from btrfs to another partition?

I had a working system that was running out of space. So I added space to the end of the disk. Boot from gparted ISO launched gparted moved partition 3 of 3 to the right. Went to resize partition ...
1
vote
2answers
20 views

Get filepath of every file that's copied from one folder to another

I am using Ubuntu 18.04 LTS and I wish to copy files from one folder to another and along with it also wish to store the filepath of each file that's being copied from folder1 to folder2 in a third ...
0
votes
0answers
32 views

Linux | Copy open files to a different directory and keep them Synchronized

I want to copy files while they are in use by an application to a separate directory on my Ubuntu system. These files in the source directory should be in continuous synchronization with their copies ...
5
votes
1answer
478 views

What happens when you rsync without a destination path? [duplicate]

I copied a file to destination without providing the path. It seems to have copied successfully, but i cant find the file in the destination, where could it be located? rsync -av --progress file.txt ...
0
votes
3answers
42 views

Copy a file in a destination folder

I have a file in a very long path, for example: /opt/very/long/path/file1 I want to copy the file in this directory: cp /opt/very/long/path/file1 /opt/very/long/path/file2 I don't want repeat this ...
0
votes
3answers
55 views

How to find the first X gb of data?

I've been trying to find a way to free up some space on a drive by moving folders to another. I have a folder full of stuff I can move, doesn't need to be all of it, to free up some space. In Windows ...
1
vote
2answers
80 views

Find and copy with exec not working

I'm using the following command to get the most recent file in a directory /usr/bin/find /home/user1/folder1/ -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " | cut -f5 -d"/" This ...
1
vote
0answers
30 views

Open USB off specific port in linux

I am using a raspberry PI. I want to create a USB bridge, meaning I can transfer the files from one USB to another automatically. My problem is finding the specific USB I want to take the files from,...
0
votes
2answers
223 views

How should I merge two folders on the same filesystem?

I have two directories that look something like the following but with many more files. folder1/pic1.png folder1/test/readme.txt folder2/guest.html folder2/backup/notes.txt I want to "merge" these ...
0
votes
0answers
42 views

Did this dd command run too fast? [duplicate]

Usually people want to speed dd up but I want to slow it down, because I think there is something fishy going on with its speed. sudo dd if=hannah-montana-linux-amd64.iso of=/dev/sdb1 bs=512k 5988+...
1
vote
1answer
168 views

rsync keeps previous partial file when resuming

I often transfer large files from a remote server using rsync with the following command : rsync -rvhm \ --progress \ --size-only \ --stats \ --partial-dir=.rsync-partial \ "user@...
2
votes
4answers
96 views

Is there a linux command to copy a file to multiple other files based on the filename? [closed]

Is there a Linux command to copy a_b_c_d.jpg into a.jpg, b.jpg, c.jpg, and d.jpg so that each file is a copy of the original? It should extract the name from the original name, separated by _ and ...
-1
votes
1answer
42 views

How to externally copy an old UFS hard drive?

Here at work our machines are required to run off of old Sun Sparc5's (1995) all running a UFS architecture on the hard drives due to a Solaris 5.3ish base. The way they are configured it is not ...
0
votes
2answers
66 views

Methods to copy a file or a folder one linux server to another linux server [closed]

What is the most accurate way to copy a file or a folder from one linux machine to another using commands?
1
vote
0answers
24 views

xclip copy file so it can be pasted as a file (not file content) [duplicate]

How can I copy a file with xclip, so that it is pastable as a file in file explorers? I searched on google an so on and found stuff like this Copy file to xclip and paste to Firefox, but there it is ...
0
votes
1answer
275 views

Only copy files from a particular date from s3 storage

I would like to only copy files from S3 that are from today out of a certain bucket with 100s of files. I tried the following: $ aws s3 ls s3://cve-etherwan/ --recursive --region=us-west-2 | grep ...
0
votes
2answers
33 views

How to copy all files in all directories with specific filename to one destination?

Let's assume that I have these files: /1/tEst.mp4 /1/Test.mP4 /1/subdirectory/TEST2.mp4 /1/.20181106Test2.mp4 How can I copy all of these files into /2/Videos with a single command line? All files ...
0
votes
1answer
53 views

On copying, which is considered: actual or apparent size?

I was wondering if I have a file that has apparent size of 1 GiB but actual size of 0 B can get copied to, for example, a USB flash stick with 512 kiB free space? You can create a file as such using: ...
0
votes
1answer
923 views

Copying a file from ROOT to home directory

I am trying to copy a file from Root directory over to my home directory. I had to execute the extraction of a file as ROOT user. I can see it is extracted into root directory but I now want to access ...
1
vote
2answers
172 views

rsync thinks the source host is a command

So I was trying to download a file from a remote host connected with SSH to a local folder on my Mac using rsync. The command I used is: $ rsync --progress -avz -e "ssh root@1.2.3.4 -i ~/.ssh/keyFile"...
13
votes
2answers
707 views

Timestamps of files copied to USB drive

I have a problem with the timestamps of files copied from my PC or laptop to USB drives: the last modification time of the original file and that of the copied file are different. Therefore, ...
1
vote
1answer
90 views

How to manage to read files unreadable due to bad sectors?

I am having ext3 filesystem, and recent Linux distribution. I need to copy (read) a file(s) over to a new destination. Unfortunately cp / mv or MC (Midnight Commander) stop / fail at certain point ...
1
vote
1answer
240 views

Makefile: Copy using make variables --> error; Not so without variables!

In the following makefile InputLocation:=./Test OutputLocation:=$(InputLocation)/Output Input:=$(wildcard $(InputLocation)/*.md) Output:=$(patsubst $(InputLocation)/%, $(OutputLocation)/%, $(Input:...
1
vote
0answers
30 views

how to move files based on birth time in hadoop [closed]

I have some 200k files in a folder, i want to organize them based on time of birth(creation time). i wrote the below script but it is way too slow. i want to improve it. how can i do it? #!/usr/bin/...
0
votes
1answer
825 views

How to copy files with grub console?

I have a notebook which can't boot up Ubuntu and I want to copy all of the files to an external hard drive with USB connection to save them. After I want to install a new Ubuntu to the notebook, how ...
1
vote
1answer
8k views

cp: cannot create regular file: Permission denied

I am running a PHP script on my Apache server and from the script I need to copy some files (to run a Bash script that copies files). I can copy to a directory /tmp with no problems, but when I want ...
22
votes
2answers
2k views

What happens when I kill 'cp'? Is it safe and does it have any consequences?

What are the consequences for a ext4 filesystem when I terminate a copying cp command by typing Ctrl + C while it is running? Does the filesystem get corrupted? Is the partition's space occupied by ...
0
votes
1answer
37 views

How to overwrite a file with shell script without using extra device space?

I'm trying to overwrite a file using: cp source.txt target.txt But I get "No space left on device". I also tried using dd with no success, even with super user. How can I overwrite using only the ...
-1
votes
1answer
60 views

How copy files from file-name list and unconditional keep existing file in destination?

How copy files from file-name list and unconditional keep existing file in destination? Note cpio is overwrite older existing files by default: $ dpkg -L libgcc1 libstdc++6 |grep -e '^/lib/' -e '^/...
1
vote
1answer
46 views

How can I copy and verify a file as I do the copy?

(Yet another "copy and verify" question...) I have a reasonable amount of data I want to copy between several HDDs, and I want to make absolutely sure the data is copied correctly. My current ...
-4
votes
1answer
406 views

Copy the file 'red' to 'blended' directory in Unix? [closed]

Please tell me how to copy a file using relative path
1
vote
2answers
167 views

How to copy a folder by overwriting an existing folder and delete all the old content in Linux?

I can use rm to delete the old folder, then use cp to copy the new folder. But how to do it in one go?
-5
votes
1answer
140 views

How to append file2 to file1 without changing their content, then output the result in file3

I have file2 and file1. I want to append file2 to file1 but without changing file1. I want to put the output in anew file file3. If I used cat file2 >> file1 this changes the content of file1.
0
votes
2answers
34 views

Copy files from one directory to another, ignoring files where the destination's file has been modified in the last hour?

Attempting to discover a command to copy files if the destination's (not source's) file has not been modified in the last hour.
0
votes
0answers
17 views

Install distributed /usr/-like package hierarchy to the /usr/ directory

I have a software package that includes headers, libraries (including lib64/), a bin/ directory, etc. that all need to be copied into the /usr/ directory; for example: ./some-package-dist/ bin/ ...
1
vote
1answer
266 views

Help with script/rsync command to move file with md5 sum comparison before deleting the source file/ [closed]

Referencing this post to find and delete duplicate files based on checksum, I would like to modify the approach to perform a copy operation followed by a file integrity check on the destination file. ...
0
votes
2answers
2k views

copy files from multiple sub-directories to the same destination directory

I have something a directory like this Main Directory SubDirectory SubsubDirectory1 xx.jpg xx,jpg SubsubDirectory2 xx.jpg xx,jpg ...
2
votes
2answers
399 views

Difference in cp -R argument?

Is there any difference between: cp -R /a/* /b and cp -R /a/. /b The original idea was to copy anything from folder /a into folder /b.
0
votes
0answers
9 views

rcp trims directory names on redhat

I've hit a seemingly undocumented error with rcp, in that it trims the first character from the name of any transferred directories, when the files originate from a remote redhat 4.8.2 machine. ...
0
votes
0answers
35 views

Linux Mint to Windows Server via SMB: find, copy rename with pwd - save to netwok location

I am trying to find file of various types (*.pst), append their directory location to the current file name and copy them from a local hard drive to a network location. find . -name '*.pdf' | cpio -...
2
votes
1answer
35 views

can cancelling a copy cause corruption?

If I decide I want to copy a folder that is sufficiently large using cp, then half way through the copy I decide to abort or pause the process, will this ever cause corruption? Would it be better to ...
1
vote
2answers
50 views

How can I copy a file and paste it as a different name?

I have a file test.txt in directory A/B. I want to copy test.txt to A/C and rename it newtest.txt. I know I can use the cp and mv commands to do this, but the issue is that there already is a test....