Questions tagged [file-copy]

Questions regarding copying files from one place to another

Filter by
Sorted by
Tagged with
0
votes
1answer
340 views

copying binary file(.jpg) works from command line but not from script

Very simple script to copy a file #!/bin/bash #copy file mtp-getfile "6" test2.jpg I set it as executable and run it using sudo sh ./test.sh It gives me a file called test2.jpg that has no icon ...
0
votes
1answer
65 views

Create folders from space-delimited filenames and copy files into them

I'm currently trying to organize several thousand files which are named according to what's in them, and the various "tags," if you will, are separated by spaces. So, for example: foo_bar bar_foo.txt ...
1
vote
1answer
155 views

run script remotely and use result locally with ssh auto login

I want to connect from ServerA to ServerB , and check Oracle Database Status and PendingLogs then record results, and use the result on ServerA ,and compare with the result on serverA and generate ...
1
vote
1answer
135 views

Pipe data onto another machine with nologin

I have a huge directory I want to copy to another machine as a .tar.gz file. I don't have a lot of space on either machine, so I'd like to copy the file through a pipe, like this: tar -czf - ...
1
vote
2answers
66 views

How can I move files from a full partition to one with more room?

How can I move files from a full partition to one with more room? Backstory: Centos7 partitioned the 1TB hard drive on installation. I didn't realize that the partition mysql installs and runs from ...
2
votes
1answer
231 views

sync a particular file recursively but only in the subdirectories present in destination

I have two directories dirOrig and dirDest in different remote servers. Both of them have numerous subdirectories at various depths. I now need to copy a specific file or extension -- say file1.txt ...
2
votes
0answers
711 views

Does Linux copy NTFS File Permissions?

I used a second HDD for data storage on my previous Windows installation (SSD). The problem is that when I try to access the files and folders Windows doesn't give me the right to do so. Is there a ...
6
votes
2answers
4k views

Why does cp --no-preserve=mode preserves the mode? Alternative tools available?

$ cp --no-preserve=mode --parents /sys/power/state /tmp/test/ $ cp --no-preserve=mode --parents /sys/bus/cpu/drivers_autoprobe /tmp/test/ The second of the two lines will fail with cp: cannot make ...
2
votes
1answer
143 views

Download/Sync files in one direction only once

I'm a bit of a hoarder and my NAS is kinda the envy of my friends. But sharing my collection is a pain with everyone spread out many KMs across my city and Canada having garbage internet. I've had ...
13
votes
4answers
46k views

Execute command in sftp connection through script

This is a very basic question I am just quite new to bash and couldn't figure out how to do this. Googling unfortunately didn't get me anywhere. My goal is to connect with sftp to a server, upload a ...
3
votes
1answer
88 views

Copy only files and only lines containing a string while preserving directory structure

Say I have a directory that contains other directories and files. I want to search for a string in each file and copy only the matching lines to another location while preserving directory structure. ...
2
votes
2answers
162 views

How to copy only good files from one directory to another?

I have corrupted filesystem. I would like to copy "survivors", remaining good files. So my question is -- how to copy only good files from one directory to another. Please note, that for example one ...
6
votes
2answers
4k views

Verifying a large directory after copy from one hard drive to another

I have a home file server that I use Ubuntu on. Recently, one of my drives filled up so I got another and threw it in there. I have a very large folder, the directory is about 1.7 T in size and ...
1
vote
2answers
300 views

cp --reflink=auto for MacOS X

cp --reflink=auto shows following output for MacOS: cp: illegal option -- - Is copy-on-write or deduplication supported for HFS? How can I COW huge files with HFS?
0
votes
0answers
132 views

rsync file permissions are changing after syncing

It looks like rsync while copying file from source to destination is changing file permissions to different i have tried all options -o,-p,-avz --no-perms --no-owner --no-group,.. no luck still rsync ...
1
vote
1answer
83 views

Translating rdist configuration with multiple roots to rsync

I am implementing rdist similar syntax to rsync and I am able sync my files and folders with rsync, but while handling this rdist syntax I am not understanding this part except (/home/user1/log1/*/*/...
2
votes
2answers
83 views

sftp: command to select desired files to copy

I have a long list of data files that I need to copy over to my server, they have the names data_1.dat data_2.dat data_3.dat ... data_100.dat Starting from data_1.dat, I would like to get all the ...
10
votes
1answer
12k views

Rsync, include only certain files types excluding some directories

I want to rsync only certain file types (e.g. .py) and I want to exclude files in some directories (e.g. venv). This is what I have tried: rsync -avz --include='*/' --exclude='venv/' --include='*.py'...
1
vote
1answer
218 views

How do I disable the “can not set attribute” dialogue in Double Commander 0.7.4?

Every time I copy files from my home (ext4) partition to a Windows (ntfs) partition in Double Commander a dialogue pops up saying "can not set attributes for... can not set date/time for..." and ...
1
vote
1answer
789 views

How can I copy a .wav file from an audio cd and verify it?

I have a hard time using Linux' built-in tools to rip an audio cd (sound juicer, rhythmbox). The reason likely being my drive, which vibrates a lot and cannot read the disk continuously. Playing the ...
1
vote
2answers
1k views

find modified files recursively and copy with directory preserving directory structure

I want to find images, from a directory, that were added in last 1 year and copy them to a new directory preserving original folder structure. I am using find but it is not copying anything. is there ...
3
votes
3answers
4k views

Copying faster than cp?

I am currently copying a large number of directories and files recursively on the same disk using cp -r. Is there a way to do this more quickly? Would compressing the files first be better, or maybe ...
1
vote
1answer
94 views

How to copy file from one use to another?

I have a web server and it using by few developers. Web-site is under website user. Other users are like user1, user2 etc. I have given sudo access to user1, user2.. to access website. The issue I'm ...
11
votes
3answers
2k views

How to copy a directory which root can't access to a directory that only root can access?

I have a directory on an nfs mount, which on the server is at /home/myname/.rubies Root cannot access this directory: [mitchell.usher@server ~]$ stat /home/mitchell.usher/.rubies File: `/home/...
1
vote
1answer
741 views

Rsync's append-verify isn't mirroring directories

I am running the command: sudo rsync -Hva --delete --progress --append-verify "/mnt/1/" "/mnt/2/". I went ahead and modified a text file in /mnt/2/. I then ran the command and I got the following ...
2
votes
2answers
779 views

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-...
2
votes
2answers
512 views

How to cp in two steps

Every once in a while, I find the need to do: cp /really/long/path/to/file.txt /totally/different/long/path/to/copy.txt Since I use autojump, getting to the directories is very fast and easy. ...
5
votes
2answers
3k views

Is rsync the fastest and most reliable way to verify whether directories are identical?

UPDATE: Reading this again, I see that it was not a good question. I think I should've asked something like how reliable is rsync -aP --dry-run /origin /dest?. Of course that the most reliable won't ...
1
vote
1answer
6k views

Capture stdout from ssh session to local machine

I am having to put together a script that will ssh into devices to run a command such as "show running-config" and save the output to a file on my local machine. I have done similar tasks like this ...
0
votes
1answer
41 views

Copy folders has specific part of name and it is content

I have a long list of folder as follow: 001_bat_3513 002_mon_3213 003_bat_3515 004_btt_3540 005_bat_4513 055_bpt_8523 056_bot_3513 058_bat_1513 . . From this list: How can I copy the folders ( and ...
2
votes
2answers
421 views

Can I use the 'cp' command with the -b option, but have it fail if the backup file already exists?

I'd like to use cp -b to copy a file to a destination, possibly creating a backup file of the destination path if it already exists. But, if the backup file already exists, I'd like to have cp fail ...
2
votes
2answers
1k views

Install the content of a folder into another

I'm trying to write a Makefile to install the content of my folder into another on the system. I would like to keep the same directory structure, like this. localfolder ├── a └── b ├── c    ...
2
votes
2answers
463 views

finding a folder names based on list contained in .txt file

I have a .txt file containing 150 different ID number on each line like so: 12345 15876 19643 12586 Located in the same directory as the .txt file, I have 300 folders and I want to copy only the ...
0
votes
1answer
492 views

How do I replace all files in a folder with one file?

I have one file, let's call it image.png. I also have a folder of files like so: picture.png file.png screenshot.png art.png painting.png And so on. What I want to do is replace each file inside ...
2
votes
3answers
117 views

Copy a lot of files recursively leads to a heat problem on my external hard drive

The Situation: I want to copy a directory recursively to an external hard drive. The directory contains a lot of files (at least 100,000). The Problem: External hard drives tend to get quite hot ...
2
votes
1answer
81 views

Fit timestamps of multiple files/folders to existing ones

I've copied a large directory to another location (through a network). I needed to preserve all the timestamps (especially ctime and mtime). However somewhere in the process I screwed things up. (I ...
0
votes
3answers
2k views

Rsync to copy specific subfolders and files to new directory

Original path, RootFolderI: RootFolderI/FolderA/Subfolder1/Subsub1/JPG1.jpg -> want this jpg RootFolderI/FolderA/Subfolder2/Subsub1/JPG2.jpg -> want this jpg RootFolderI/FolderA/Subfolder2/...
1
vote
1answer
163 views

parallel file copy using tee unexpectedly slow

we're copying a large zfs snapshot (zfs send) from site-1 to site-2. site-1 and site-2 are remote, and are connected via IPsec (read: slow) on site-2, we need the data on two different zfs servers. ...
18
votes
5answers
45k views

Duplicate file x times in command shell

I try to duplicate a video file x times from the command line by using a for loop, I've tried it like this, but it does not work: for i in {1..100}; do cp test.ogg echo "test$1.ogg"; done
6
votes
2answers
4k views

Right click menu in Nemo missing 'create shortcut' and 'copy/move to'

I recently did a clean install of Linux Mint 17.3 with Cinnamon on my machine. Before the clean install, if I right clicked on a file or folder in nemo, the menu would have a 'create shortcut' option....
3
votes
3answers
139 views

rename(1)-like script in Perl, but for copying files?

So there's this rename(1) Perl thing. It suits my task precisely, except that I need it to basically cp files instead of mv. How to achieve that? I have quite a few rules of renaming, all expressed ...
1
vote
1answer
200 views

Can I clone a larger disk with lots of free space into a smaller disk

Is it possible to clone an OS disk with all its partitions into a smaller disk. The original disk has a lot of free space and the total used space is much smaller than the capacity of the new disk I ...
-1
votes
1answer
48 views

How can I successfuly port W10 files to Ubuntu? [closed]

I just installed Ubuntu (Dual boot with W10) and I can see my W10 partition from inside Ubuntu with all my files. They seem fairly corrupt on the Linux side (Text editors, web browsers, Steam etc) ...
2
votes
2answers
728 views

Change directory without using 'cd' [closed]

I have a list of files with their paths in a text file. And I want to copy these files, mentioned in list, to another directory with their parent folders tree. Also my shell-script to copy these files ...
1
vote
0answers
94 views

Copy directory tree, changing the target of absolute symbolic links

I wondered if there's an easy way to copy, scp, pipe tar, etc. host1:/base1/dir1 to host2:/base2/dir1. Other than the base directory, all the directory structure should be identical. `host1:/base1/...
3
votes
3answers
383 views

Copy subfolders containing at least n files

I have a folder root_folder containing a lot of subfolders. Each of these subfolders contains a small number of files (between 1 and 20) and I want to copy all the subfolders containing at least 5 ...
1
vote
1answer
34 views

Is there any ways to copy all file to one specific sub-folder under the same parent-folder? [duplicate]

So for example i have one folder called "test". Inside that folder, i created one another folder called "player" and a lot of text file, let's say 50 files. [root@ip-10-0-7-70 test]# ls kaka.txt ...
7
votes
1answer
6k views

how do I exclude a specific folder on the destination when using rsync?

consider the following example: /source /source/folder1 /source/folder2 /source/folder3 /destination /destination/folder2 /destination/folder3 /destination/folder3/mytestfolder1 /...
2
votes
2answers
2k views

Prevent updates to 'modified time' when copying files to a mounted Samba folder

I don’t want the “last modified” attribute to be changed to the current date when copying files to a mounted Samba folder. How can I do this? This behavior occurs with (K)Ubuntu 12.04 and Ubuntu 15....
1
vote
0answers
535 views

PSCP - why can't it find the file when using non-admin credentials?

I am trying to make a batch script to get files from Windows vm to Ubuntu vm so I decided to use pscp. when I put pscp -l admin -pw pswd C:\path admin@IP:/path the files transfer fine but I don't ...