Questions tagged [file-copy]

Questions regarding copying files from one place to another

Filter by
Sorted by
Tagged with
8
votes
2answers
5k 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 Debian 9.1 with KDE machine. The problem is that I keep getting: The process for the mtp protocol died unexpectedly. ...
1
vote
2answers
7k 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
73 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
79 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
594 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
53 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
474 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
253 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
190 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
339 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
476 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
285 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
5k 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
121 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
40 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
462 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
94 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
341 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
113 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
34 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
519 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
394 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
709 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
407 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
170 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
147 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 ...
3
votes
1answer
2k views

Copy files with long names [closed]

I am on linux ubuntu 16 and I need to copy around 400gb(some 100.000 files) of data from my HDD to my SSD. This I can't do because around 1000 of those files have "too long name" and I can't just skip ...
0
votes
2answers
283 views

Cleanest way to copy data from UFS file system to FAT file system?

On x86_64 machine running FreeBSD 10.1 when I'm un-taring an file and getting below error for all files in tar : x var/lib/nfs/statd/sm.bak/: Can't set user=1002/group=1002 for var/lib/nfs/statd/sm....
1
vote
1answer
42 views

File change list under certain folder with huge content and multiple level of subfolders (with decent performance)

I am asking the same question as this: How to list files that were changed in a certain range of time? BUT. with a twist: I have 10 folders with huge content(13Tb) and multiple folders with multiple ...
0
votes
2answers
881 views

Fastest way to duplicate files from one USB flash drive to multiple others?

I 'm working on a bash script to copy files from a single USB drive to multiple others. I'm currently using rsync that copies from the source to a single destination, going through all of the output ...
1
vote
0answers
84 views

copy in Linux does not work as expected with bootrom files

I have a bootrom file (binary file) which I copy it on a USB drive (to boot a target) using Linux cp (I have also tried with dd). The file is copied to the first partition which is formatted with ...
-1
votes
1answer
598 views

File not copy to remote pc using ansible

I am using ansible-2.0 on linux machine and create the ansible-galaxy, on it created the dns.yml file which replace the /etc/resolv.conf on remote machine but it's not working. Ansible status showing ...
0
votes
1answer
141 views

rsync and cp producing different results

I was upgrading ModX today and tried to merge the new installation with the existing copy on my server. On their site ModX says to "merge directories", which I assume means to recursively copy every ...
1
vote
0answers
793 views

Use rsync to compare a remote directory with a local one, and store differences to another local directory

My problem is similar to the one described in this question. I want to compare a directory to another, and store the differences in a third one. The difference is that in my case the first directory ...
0
votes
0answers
371 views

Why is copying many files with Caja much slower than compressing+copying+uncompressing?

I am currently working with HASYv2 dataset which contains the hasy-data directory with 168.233 images of size 32px x 32px. I just wanted to copy that directory with Caja, but I skipped this after ...
2
votes
1answer
8k views

cannot create regular file permission denied

I have a NAS whose ip is 192.168.1.7 There is a share on the NAS named music and in that share is a folder named 'archives'. I want to copy a file from my local hard drive /data/favourites/my-web-...
4
votes
1answer
10k views

What is the difference between `dd`, `cp` and `rsync`? [closed]

Besides the explanations from the man pages and --help information, in which way do the commands dd, cp and rsync differ when used to copy files? In which context is each of these superior to the ...
5
votes
3answers
24k views

Copying files from my (windows) computer to a remote system over ssh [closed]

I have some files on my laptop which I want to copy them on a remote cluster. To this end, I use PuTTy to SSH the remote cluster. Then to copy files, I use PuTTy terminal and after logging to the ...
0
votes
2answers
278 views

Copying files in bash

I want to copy all files (included sub-folders) from $HOME directory to Desktop in bash. And as you know the Desktop is in $HOME. So, when I copy all files I get the message like this: cannot copy ...
2
votes
1answer
110 views

Extract a single file from a list of directories in Linux

I have a folder that contains 1208 folder. In each of these folders, I have 6 different files which follows a special naming criteria. What I need to do is to get only one of these files from all the ...
0
votes
2answers
131 views

move only uniq files from one directory to other [closed]

I want to move files from directory A to directory B. But there are some conditions. directory A structure: a.txt_20170502 b.txt_20170502 a.txt_20170507 asd.txt_20170509 asd.txt_20170522 So, I ...
3
votes
3answers
826 views

Copying file to destination directory overwrites directory with file

A script which runs on Solaris uses cp to copy a single file into a destination directory. On occasion this cp command will overwrite that destination directory with the file being copied For ...
0
votes
1answer
30 views

Copying a text file into a calculation sheet with a script

I would like to create a script that can write up from a text file a LibreOfficeCalc or equivalent table with the same columns than the following those from the following lines from a text file : [1] ...
3
votes
2answers
276 views

Take all the file structure but these directories

I want to copy an entire file structure (with thousands of files and hundreds of directories), it's a hierarchy of directories and there are those node_modules directory that I want to exclude from ...
1
vote
4answers
587 views

copying multiple files by filename [duplicate]

I need to copy 150 file from a directory containing 900 files. I have the name of all 150 files in a text file, list.txt. How can I do this in Linux?
1
vote
2answers
973 views

How to gzip and copy files keeping its directory structure?

How can I gzip and copy files to another folder keeping its directory structure with one command in Linux? For example, I have: /dir1 /dir1/file1.fit /dir1/file2.fit /dir1/file3.fit /dir1/dir2/file1....
0
votes
1answer
5k views

SSH copy command is returning exit code 1 [closed]

I am using ssh to copy files from one directory to another, but I get the following error when doing so: SSH: EXEC: STDOUT/STDERR from command [cp /usr/local/jboss/server/deploy/somewarfile.war /opt/...
1
vote
2answers
605 views

copy files to a new name - shortest way

In a directory, I have about 150 files with a certain extension, for example: abc.ext def.ext ghi.ext ... Now I want to copy all of these files also to a new filename (without extension): abc def ...
1
vote
2answers
36 views

Copy files from a folder if they're in another folder too

Considering folderA containing those files: foo bar baz and folderB containing those: foo baz foobar qux How can I copy foo and baz from folderA to a new folderC? Note that I'm comparing only ...
1
vote
1answer
3k views

Restore directory to previous state

I have an approximately 1TB directory with subdirectories dir1. I have made an rsync backup copy dir1.back. How can I efficiently restore dir1 to the state of dir1.back - that is, replace files in ...