Questions tagged [file-copy]

Questions regarding copying files from one place to another

Filter by
Sorted by
Tagged with
3
votes
3answers
50 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
601 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
152 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
79 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
880 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
556 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
124 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
271 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
130 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
2k 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
1k 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
4k 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
57 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
603 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
858 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
88 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
447 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 ...
2
votes
1answer
2k 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
696 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
57 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
1k 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: ...
8
votes
1answer
6k views

How to get the Samsung Galaxy S5 to work with MTP on Debian 9?

So I'm trying to share files between the Samsung Galaxy S5 with Android and my Debian9/KDE machine using MTP instead of KDE Connect. The problem is that I keep getting: The process for the mtp ...
1
vote
2answers
8k views

ls shows a directory but it is inaccessible

I was trying to copy one folder from one location to another. The folder is about 6.4 Gb. So I did cp -r source_folder level1/val after that, I went into the level1 folder and checked: level1$ ...
2
votes
2answers
74 views

Where does the file size comes from, i.e. , how does ls and cp know the file size?

Recently I had a file that reported a file size of 33P bytes in my 500GB SSD, more details here. That was through ls and cp would report that there was no enough space. In my short knowledge and ...
1
vote
1answer
96 views

Is there any option/command to differentiate files based on copy status of the file in the directory?

I have the below code which checks if the file in the directory is in copy/load status from another application in a directory. Code: for file in PATH/* do lsofresult=`lsof | grep $file | wc -l`...
0
votes
1answer
714 views

Why does Synology DSM's “USB Copy” skip Umlaut-named files?

Background I have a large number of files from my mac that I first copied to a FAT32 hard drive and now migrated to a Synology NAS (DS216 with DSM 6 in my case, using ext4 internally) with rsync. I ...
2
votes
2answers
61 views

Replace file if and only if stdin differs from file contents

I am looking for a program that takes a file name (e.g. as an argument), reads from stdin into a buffer, and compares this with the contents of the named file. If the contents differ, the program (...
1
vote
2answers
614 views

Backup all contents of current directory to a subdirectory inside the current directory, which will be created if not exists

Right now I have following command to copy all contents of the current directory to sub-directory, provided if the subdirectory is created in advance: cp -p !($PWD/bakfiles2) bakfiles2/ But I have ...
2
votes
1answer
322 views

rsync - copy contents of the directory only if a certain file doesn't exist

We want to migrate contents of an old server to a new one but rather than coping everything, we want to exclude any directory that has a .swf file in it. We are aware of the --exclude flag but it will ...
1
vote
1answer
227 views

recursively sync only specific files from specific subdirectories from a remote server

The directory structure I have is as follows ./model1 ./model1/correct_data/file1.txt ./model1/bad_data/file1.txt ./model2 ./model1/correct_data/file1.txt ./model1/bad_data/file1.txt I only need to ...
0
votes
1answer
406 views

How to use rsync to force all *.jar files to match?

I have a directory with many files in it. The only ones I care about are those with the extension .jar. However, there are other files in the directory as well. I have a source directory with only ....
0
votes
3answers
537 views

Is there a `cp` like command for verifying data and removing files?

I have some photo files on my phone, and I am backing them up to an external drive. (Everything is mounted on a linux laptop.) I have copied the files, when I should really have mv'ed them. However, ...
0
votes
1answer
393 views

Rename Files After Pulling up same name file from different servers

There is a file named "dhcp.db" on all my DHCP servers. I need to fetch this file from all the dhcp servers and place them in a folder of my Enterprise server. However I'm not able to do so as the ...
0
votes
2answers
6k views

Copy whole folder from source to destination and remove extra files or folder from destination

I need to copy all files and directory from source let's say /var/www/html/test/ to destination /var/www/html/test2/. Destination can already have extra files and folders which i need to remove after ...
1
vote
1answer
152 views

How can I overwrite the destination file netcat writes to as opposed to appending?

I have two ubuntu servers and will be using a script (although I have not written it yet) on the sending server to send file abcd.txt whenever it changes using: nc 10.10.10.4 3333 < abcd.txt On ...
1
vote
1answer
42 views

Copying a tree with modes

Suppose my build script creates something like: build ├── [drwxr-xr-x pskocik pskocik ] bin │   └── [-rwxr-xr-x pskocik pskocik ] FOO_bin ├── [drwxr-xr-x pskocik pskocik ] include │   ├── [...
1
vote
2answers
530 views

Archiving user home folder to remote server, without following symlinks?

We need to do a once-only archive copying of users' home folders to an archive server (pending final deletion) when they leave, in case they later discover that they may still require some of their ...
1
vote
2answers
100 views

Copy all files recursively without replacing

Scenario: Source dirs: /day1/hour1/instance1/files.ext /day1/hour1/instance2/files.ext /day1/hour1/instance3/files.ext /day1/hour2/instance1/files.ext /day1/hour2/instance2/files.ext etc.. Target ...
1
vote
1answer
464 views

Selectively copy from a collection of remote directories

I have a remote machine with a large number of numbered directories, like so: dir1 dir2 dir3 ... dir40 each of which contain several numbered files: file1 file2 file3 ... file2530 I want to copy ...
0
votes
2answers
125 views

Copy directory structure with random number of files

Is there an elegant and fast way to copy a certain directory structure and only select a random amount of files to be copied with it. So for example you have the structure: --MainDir --SubDir1 -...
1
vote
1answer
36 views

Size difference copying from NFTS to HFS+

This is my first post here, thanks for helping out! I have two external hard drives, HD #1 is NTFS and HD #2 is Mac OS Extended (I think this is the same as HFS+). I am copying many files from #1 to #...
12
votes
1answer
526 views

How to copy all files in a folder excluding files which are being written?

I download multiple files to a folder downloading via HTTPie. A bash script aims to process downloaded files, and I tried to copy the downloaded files to another folder as find /folder/downloading -...
0
votes
1answer
478 views

problems in tranferring flies from windows host to kali linux guest in virtual machine

I am trying to transfer files from my Windows host to kali guest in kali linux but the sudo mount -t vboxsf file_name_host file_guest does not work because it says unknown file system vboxsf ...
-1
votes
2answers
818 views

How do I copy a file from a remote system to local? [duplicate]

I'm on a virtual machine trying to copy a file from SSH to local system. Using Debian. I don't see the "Connect to" option. When I try to do it trough terminal, I enter scp [myusername@remote.system]:...
0
votes
1answer
456 views

possible to copy from one remote computer to another remote computer using smbclient?

So I know how to use smbclient to copy a file from a remote server to my local computer similar to this: sudo smbclient //192.168.105.250/sharename --user='<user>%<pwd>' -c 'cd import\...
1
vote
0answers
181 views

How can I copy/move the same x files from one directory to another?

I have multiple directories with a few thousand files each. Each directory contains files with the same names, but with different extensions. I would like to move x files each from these sets of ...
0
votes
1answer
169 views

cp/rsync both grind to a halt when copying to USB/Micro SD

I'm trying to transfer about 20GB of music from my Arch Linux laptop to a Micro SD card, via a USB reader. The process starts off fine; the first ~50 songs take a combined one second, although from ...