Questions tagged [file-copy]

Questions regarding copying files from one place to another

Filter by
Sorted by
Tagged with
1
vote
1answer
57 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
1k 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
308 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
195 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
35 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
18 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
381 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
3k 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
523 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.
2
votes
1answer
36 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
54 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
59 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 ...
5
votes
3answers
777 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
1answer
706 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
394 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
156 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 ...
1
vote
1answer
147 views

10Gb network. Can browse share (samba/nfs) from clients, but initiating a copy takes server's network down?

I don't really know where to start, as I'm not very familiar with Linux at all. We have a LTO6 tape system bought in 2014 from Cache-A running CentOS. It came pre-installed and configured, ready to ...
2
votes
2answers
99 views

“standard” single-command alternative for `mkdir -p BASE/a/b/c && cp -a -t BASE/a/b/c /a/b/c/d`?

The sequence of commands mkdir -p BASE/a/b/c && cp -a --target-directory=BASE/a/b/c /a/b/c/d creates a subdirectory a/b/c under BASE, and then copies the directory tree at /a/b/c/d to BASE/a/...
2
votes
1answer
180 views

Copy a file > 4GB to exfat fails with 'Error closing file: No space left on device'

I have a 64GB flash drive plugged into a router. The router exposes the drive as a Windows share using Samba. The drive is formatted as exFAT and mounted successfully at /mnt/routerusb: mount.cifs /...
0
votes
1answer
379 views

Not able to scp files. Possibly a syntax mistake?

I am trying to use an SSH connection to connect from a Windows PC to a remote Ubuntu. I tried copying a file from the remote machine, being in the relevant file directory like such: scp filename C:\...
1
vote
2answers
359 views

Overwrite file preserving target permissions without shell invocation

I have this situation $ ls -la -rw-r--r-- 1 user user 123 Mar 5 19:32 file-a -rwx---rwx 1 user user 987 Mar 5 19:32 file-b I would like to overwrite file-b with file-a but I would like to ...
0
votes
2answers
2k views

how to create progress bar during copy files

I need to copy huge files in my Linux machine. Example: cp source.txt target.txt I want to create bar progress that will show that copy still in progress on each copy file Examples" cp file file1 ...
0
votes
2answers
408 views

Copy all folders that contain file(s) with the given extension

In a Mac Terminal, I want to find all directories that contain at least one file with the specified extension and copy them somewhere else. I found find . -iname '*.jpg' -exec dirname {} \; which ...
1
vote
2answers
1k views

rsync a file from server C to A through server B [duplicate]

I have computers A, B and C. Every one of them has ssh enabled and I can use rsync. A can ssh to B B can ssh to C A can't ssh to C B has public ssh access, so A can connect B and C can communicate ...
23
votes
5answers
4k views

How do programs that can resume failed file transfers know where to start appending data?

Some file copying programs like rsync and curl have the ability to resume failed transfers/copies. Noting that there can be many causes of these failures, in some cases the program can do "cleanup" ...
4
votes
1answer
258 views

Moving millions of small files results in “out of space” error

I't trying to move around 4.5 million files (size ranges from 100 - 1000 bytes) from one partition to other. The total size of the folder is ~2.4 GB First I tried to zip it and move the zipped file ...
3
votes
3answers
48 views

Moving specific files to two different locations [closed]

I am having a query regarding file separation in unix. Suppose in a unix directory there are multiple files with different names but having same extension. E.g. /dir/AB_123yuu.pdf /dir/SD_234ggj.pdf /...
2
votes
2answers
521 views

find + xargs - copy/move files from one subdir to another

My folder structure is like this: /volume1 /photoTest /folderA /@eaDir /eaDir_tmp /folderB /@eaDir /eaDir_tmp /folder with space /@eaDir /eaDir_tmp ...
-1
votes
1answer
118 views

Copy a file to a folder, which has the same name as the original

Hopefully, this should be an easy question for the experienced. I have a list of folders (x1,x2, ..., xn) in a folder called "origin" (i.e. /origin/x1, /origin/x2 etc). I want to take a particular ...
16
votes
1answer
1k views

Approximating atomic move across file systems?

I have to move some files from one filesystem to another under Ubuntu. However, it is very important that the files never exist as partial or incomplete files at the destination, at least not under ...
2
votes
1answer
77 views

Accidentally trashed large file

I accidentally moved an entire directory of ~100GB to trash. I was trying to place it in bookmarks but dragged it into trash. It's there in the trash. But when i try to restore I run out of space ...
-1
votes
1answer
692 views

How to copy random files to a directory

First of all it isn't a homework. I just don't want to dig through a bunch of manuals and learn to program shell from A-Z to do this one thing. I have a folder /mnt/hdd/files with lots of subfolders ...
5
votes
3answers
2k views

Shell Script: Copy first file from multiple folders into one single folder

In a directory, I have hundreds of sub-directories. Each sub-directory has hundreds of jpg pictures. If the folder is called "ABC_DEF", the files inside the folder will be called "ABC_DEF-001.jpg", "...
6
votes
2answers
3k views

cp losing file's metadata

I have an Asustor NAS that runs on Linux; I don't know what distro they use. I'm able to log in it using SSH and use all Shell commands. Internal Volume uses ext2, and external USB HDs use NTFS. ...
2
votes
2answers
476 views

Causes for inefficient I/O?

I'm rsync'ing a huge folder from an external to an internal 3,5" HDD, both 5.400 rpm. When using dstat to have a look at the current throughput, I regularly see patterns like this: --total-cpu-usage--...
-1
votes
1answer
103 views

Is “install” a shortcut for cp + chown + chmod, or does it do more?

I read man install, and it seems that it just copies files with ownership & mode. So, is install a shortcut for cp + chown + chmod, or does it do more, under the hood?
2
votes
1answer
206 views

How to copy and add prefix to file names in one step from another directory?

I want to copy and rename multiple files from one directory to another. Particularly, I want something like this: /tmp/tmp.XXX/aaa.original.txt /tmp/tmp.XXX/bb5.original.txt /tmp/tmp.XXX/x2x.original....
0
votes
1answer
87 views

Copy files from a failing drive

A fried of mine gave me her laptop because it was behaving wierdly. This was (Still is) a hard drive failure, and I suggested her to backup her files before installing a new hard drive. I booted the ...
0
votes
1answer
1k views

How to copy files and folders from a usb ntfs filesystem to internal ext4 without importing permissions?

I have a USB disk that I use to synchronize data between computers with different operating systems (currently using a nice GUI utility called FreeFileSync), and its format is NTFS (which is ...
1
vote
2answers
847 views

How can I copy files by modified date using terminal? [duplicate]

I am attempting to copy files based on their modified date, as the file names do not include the date in them. Coincidentally, the files are the 22 newest files in the directory, so if I run the ...
1
vote
1answer
3k views

copy files and append in another directory?

I have five directories Dir1, Dir2, Dir3, Dir4, Dir5. In each directory, I have five text files (which are named as file1.txt, file2.tx,.file5.txt) that contain data. What I want is to copy file1.txt ...
1
vote
0answers
55 views

what is the best approach to move /var?

we have linux red hat 7 we want to keep the /var on other volume so the plan is to: mkdir /var_copy cp -rp /var/* /var_copy umount /dev/mapper/vg-a-var /var rm -rf /var mkdir /var mount /dev/...
2
votes
4answers
527 views

copy and rename files 2 directory up

I am trying to copy multiple files named "F3.bam" two level of directories to up and then rename these files with the name of the sub-directory after copy. For example: /samples/mydata1/RUN1/ID_date/...
3
votes
1answer
709 views

rsync update only timestamp

I use the following command to synchronize two folders : rsync -avhiu --progress --stats folder1/ folder2/ But unfortunately I have a bunch of file which differ only by their time stamps and rsync ...
1
vote
1answer
83 views

copying a file from one linux disk to another via windows smb has pauses

Bit of an odd question, and very hard to search on. What I am doing is copying a file from a mech disk to an ssd on an ubuntu 16.04 system, via smb shares. The copy works, but it will run at about 80-...
2
votes
1answer
372 views

Rsync transfers more data than difference between source and destination, why?

I am transferring a file from source computer C1 to destination computer D1 [ not within the same lan] using rsync. File A in C1(source) is an updated version of the file B in D1(destination). file A ...
1
vote
1answer
1k views

Getting error while using sftp (get: Invalid Flag -r)

I want to copy a few folders from Server A (/aaa/bbb/ccc/) to Server B (/xxx/yyy/zzz/), considering Server A is source and Server B is destination. There are multiple folders in ccc/ which need to be ...
1
vote
2answers
477 views

Where does rsync copy a file if I don't specify the remote path?

When using rsync to copy files over the network, I give a path so that rsync will know where to put the file on the remote server. rsync -av /home/ME/myfile user@remoteserver:/home/ME/ If I leave ...
1
vote
0answers
56 views

copy a full directory (all levels) from one server to many servers

I have a linux server : a1 it's local disk is : /scratch a directory in local disk is : /scratch/builda /builda has over 100K files and is about 100GB My compute cluster has about 100 servers - ...
5
votes
4answers
956 views

Move files between Linux and OpenBSD and keep file properties

I would like to move/share some files between Linux and OpenBSD. What would be an easy and simple way to achieve this? These are the solutions I have found so far and why I am not fully convinced: ...