Questions tagged [file-copy]

Questions regarding copying files from one place to another

Common mechanisms include:

  • cp
  • rsync
  • dd
  • rcp
  • install
  • pax
  • tar
  • cpio
681 questions
140
votes
4 answers

Copy the contents of a file into the clipboard without displaying its contents

How to copy the contents of a file in UNIX without displaying the file contents. I don't want to cat or vi to see the contents. I want to copy them to clipboard so that I can paste it back on my windows notepad. I can't copy the file from that…
Web Nash
  • 2,283
23
votes
5 answers

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" some cases the program can't. When these programs…
11
votes
2 answers

cp --backup=numbered for folders

To backup existing files with number suffixes, I can do the following: cp --backup=numbered afile /path/to/dest But this does not apply when I try to do the same with a folder: cp -R --backup=numbered afolder /path/to/dest How can I achieve…
qed
  • 2,669
10
votes
5 answers

Copy file along with creating directory

I have a file in a directory as /a/b/c/xxxxx.sql I have another directory, /a/b/d, having no further subdirectories. How should I copy xxxxx.sql into /a/b/d, to have the new file with directory as /a/b/d/c/xxxxx.sql, in a single command?
10
votes
5 answers

Moving millions of files to a different directory with specfic name patterns

I have millions of files with the following nomenclature on a Linux machine: 1559704165_a1ac6f55fef555ee.jpg The first 10 digits are timestamp and the ones followed by a _ are specific ids. I want to move all the files matching specific filename…
Apricot
  • 487
6
votes
2 answers

Can I copy a folder with a progress bar?

I want to copy a folder with some kind of progress bar. I tried "pv" (Pipe Viewer) but it seems there is no way to copy a folder. Actually I'm not interested in using a script for pv - I would prefer some 'ready-to-go' package.
Lucas
  • 403
4
votes
2 answers

Copying files based on a condition

Here's the problem I'm attempting to solve: Let's say I have a directory "A", containing some files as well as some other directories. I want to copy all the files directly under directory A to directory B. I want to recursively copy all the…
user2398029
  • 215
  • 2
  • 5
3
votes
2 answers

How to merge contents of two directories, skipping folder names that match?

I have a portable disk with contents like this: /media/usb1/CBCradio3/1.wav /media/usb1/CBCradio3/2.wav /media/usb1/CBCradio3/3.wav /media/usb1/CBCradio3/4.wav /media/usb1/podcasts/1.wav /media/usb1/podcasts/2.wav /media/usb1/podcasts/3.wav And a…
Village
  • 5,035
  • 15
  • 50
  • 84
3
votes
1 answer

How to move /usr from one partition to another partition safely

Linux, Debian. Now I have: /dev/sda5 on / /dev/sda6 on /home /dev/sda7 on /usr I would like to use sda6 to hold /usr, then free /dev/sda7 for other use. What is the safest way to do this? I am confused about how to create a /usr on /dev/sda6…
BufBills
  • 3,095
2
votes
1 answer

Copying files from USB drive fails - I/O error or Invalid Argument

I'm trying to copy files from an USB stick to another drive. At least the file names appear to be corrupt, ls shows them as: 'ZHECMIv'$'\027''.PDF' 'ZHEKMI>2.P─F' …
Peregrino69
  • 2,417
2
votes
2 answers

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.
prosti
  • 1,038
2
votes
1 answer

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 let the copy finish and then delete the files?
nobody
  • 68
2
votes
2 answers

How to copy multiple files with a same name from children directory to another directory without losing the parent directory?

I've little inconvenience while copying image files from another Android Project to my current one. Suppose I've files called nice_little_icon.png in each of the directories drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi and…
2
votes
1 answer

copy files down the tree but only copy the files not the directories in target

example I have 100 folders each with JPG and MOV files in them I want to copy all the jpg into one folder and all the mov files into another example folder1 has one.jpg and two.jpg and one.mov folder2 has two2.jpg and two2.mov folder3 has xxx.jpg…
1
vote
2 answers

Is there any file copying commands that can copy some amount of files locally or across network, and rest for a while?

For example, able to do cp -R folder1 /Volume/Data or some_cp folder1 peter@192.168.1.87/some/path/folder1 and copy 15GB of files, and then sleep for 20 or 30 seconds? So whenever the command has copied 15GB, it will sleep for 20, 30 seconds, or…
nonopolarity
  • 3,069
1
2