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

7
votes
2answers
1k views

Why are there no file insertion syscalls

To my understanding, for manipulating files there is only the sys_write syscall in Linux, which overwrites the file content (or extends it, if at the end). Why are there no syscalls for inserting or ...
0
votes
1answer
36 views

cp command saying directory does not exist when it does [duplicate]

I'm writing a bash script and in it I'm doing something like the following: #!/bin/sh read -p "Enter target directory: " target_dir cp some/file.txt $target_dir/exists/for/sure/ When I run this ...
0
votes
5answers
83 views

Special “copy and rename” case

I have a deeply nested folder structure in which there are hundreds of files called data.log. I need a script to rename each of these data.log files according to the name of the parent folder they are ...
4
votes
1answer
79 views

Move/copy millions of images from Macos to external drive to ubuntu server

I have created a dataset of millions (>15M, so far) of images for a machine-learning project, taking up over 500GB of storage. I created them on my Macbook Pro but want to get them to our DGX1 (GPU ...
0
votes
0answers
9 views

Can the USB subsystem copy only one file at a time?

Xubuntu 18.04 up-to-date $ uname -a Linux haggis 4.15.0-48-generic #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux In one session, I'm copying a lot of files from a LV with ...
2
votes
1answer
37 views

How to write a script to move files with a specific name from folder “A” to folder “B” in my Google drive?

How can I write a script that moves files with a certain name from a certain folder to another certain folder in my Google drive? Example: I have a folder named 'A' with three files named 'X', 'Y', ...
0
votes
2answers
46 views

Copying files based on partial names in a file

I have millions of xml files in a folder. The name of the files follow a specific pattern: ABC_20190101011030931_6049414.xml In this I am interested only in the last set of digits before xml ...
4
votes
1answer
406 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
37 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
86 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
44 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
223 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
260 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
75 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
33 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
46 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
36 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
488 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
56 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
78 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
98 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
33 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
485 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
57 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
253 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
97 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
46 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
91 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
32 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
487 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
56 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
1k 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
246 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
812 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
110 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
427 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
1k 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
11k 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
41 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
70 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
53 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
973 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
258 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
172 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/ ...