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

1
vote
2answers
17 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
30 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
466 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
34 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
44 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
74 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
28 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
52 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
40 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
85 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
39 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
49 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
21 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
118 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
31 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
50 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
455 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
127 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
601 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
72 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 ...
0
votes
1answer
100 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
28 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
514 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
5k 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
36 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
54 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
43 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
95 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
88 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?
-4
votes
1answer
99 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
31 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
16 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
186 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
766 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
285 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
8 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
32 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
34 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
49 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....
1
vote
0answers
42 views

Copying files from Linux Server to Local (Windows)

I had a look into all the threads for resolving my issue before posting it here but unfortunately I couldn't solve it. I would like to copy the files from my linux Server to my local Windows desktop ...
0
votes
0answers
35 views

How to limit kernel cache for copying large files

Does anyone know how i can limit the cache when the system is copying large files? The scenario is that i have about 1.5 GB or ram available and when i upload an image to the disk the cache gets ...
0
votes
0answers
36 views

Copy 1.6 TB of data from NAS on server1 to a NAS on server2

I would like to know the quickest way to copy huge amount of data present on NAS of server1 to another NAS on server2. Both the servers are linux. I'm thinking scp would be slow and take a lot of ...
5
votes
3answers
749 views

How to copy a file with unique name without navigating to directory?

Let's say I have a file with a unique name (e.g.Screenshot20180509143013.png) that I wish to copy to /media/SD256. The file /media/drive1/Users/name/Pictures/Screenshots/Screenshot20180509143013.png ...
0
votes
0answers
367 views

Transferring files from CentOS to Windows with xfreerdp (X11 Remote Desktop Protocol)

Although I can connect to a Windows server machine from CentOS via freerdp, I can not share drives for file transfer. The following command works fine # xfreerdp -u administator 10.1.1.2 However, I ...
0
votes
1answer
513 views

Logrotate copytruncate option taking too much time

I am running logrotate every 4 hours using crontab. I want to rotate files at every 50G which is expected in 4 hours. My logrotate.config is like below : /log/*/*/*/*.log { size 50G ...
1
vote
2answers
257 views

scp file to server with user different than ssh login

I need to copy file somefile.jar from local computer (cygwin) to remote server.local. I have an ssh login corp to server.local that a sudoer on server.local. I need to place the file to folder /opt/...
1
vote
1answer
95 views

How to copy a file I have permission to execute, but not permission to copy?

I have a file in a subdirectory of /etc/ which I would like to copy, I can run this file as a regular user, however when I run cp /etc/subdir/desired_file . I am refused permission. However I can ...
0
votes
0answers
65 views

Possible substitute of sync() and fsync()

I am trying to learn sync() behaviour it(sync()) took too much time for ex. around 30 mins sometime. How can I reduce time taken by sync() I tried fsync() as a substitute of sync() but not much ...