I've been trying to use rsync to simply copy all my TIF image files from the current folder onto a 'HR' folder under 'Documents' with no success so far, by the following command:  rsync -r *.tif /home/myusername/Documents/HR   As I see it the -r option is the one used for recursive copying but said command only copies whatever TIF file there is on the current folder.  Could anyone please tell me where I went wrong with it?  Suffice to say,said current folder has lots of multilevel  subfolders containing hundreds of TIF files.
36788
I am trying to create a directory that will house all and only my PDFs compiled from LaTeX. I like keeping each project in a separate folder, all housed in a big folder called LaTeX. So I tried running:  rsync -avn *.pdf ~/LaTeX/ ~/Output/   which should find all the pdfs in ~/LaTeX/ and transfer them to the output folder. This doesn't work. It tells me it's found no matches for "*.pdf". If I leave out this filter, the command lists all the files in all the project folders under LaTeX. So it's a problem with the *.pdf filter. I tried replacing ~/ with the full path to my home directory, but that didn't have an effect.  I'm, using zsh. I tried doing the same thing in bash and even with the filter that listed every single file in every subdirectory... What's going on here?  Why isn't rsync understanding my pdf only filter?    OK. So update: No I'm trying  rsync -avn --include="*/" --include="*.pdf" LaTeX/ Output/   And this gives me the whole file list. I guess because everything matches the first pattern...
31057
I'm trying to move the last 8 files from the Documents directory to another directory, but I don't want to move them one-by-one to that specific directory. Is it possible to move them with a substitute of the tail command, but for directories instead of files? I mean I'd like to do so with something like tail -8 ./Documents | mv ./Anotherdirectory or with mv tail -8 ./Documents ./Anotherdirectory.  In fact, I'm looking for a clever way I could move the last 8 files (as listed in ls) quickly (without typing out each name) to the other directory. Any suggestions?
8430
I'm not well versed in shell scripting but I imagine this to be a painfully easy fix but its eluding me.  I need to copy the contents of a directory excluding a number of files. I have a command that works when I enter it into the terminal, but when its run in a shell script it fails with a syntax error or just doesn't work.   The command in question is:  cp -r path/to/!(dir1|dir2|dir3) destination   Any help would be greatly appreciated!
58888
I have a large folder of pictures (thousands), and I have a long list of files, by exact file name, that I need to copy to another folder. I want to know if there is a way I can select several specific files from this folder, by name, and copy them to another folder, using the terminal, without copying them individually?
17357
I would like to transfer files between two remote hosts using on local shell, but it seems rsync doesn't support synchronisation if two remotes are specified as follow:  $ rsync -vuar host1:/var/www host2:/var/www The source and destination cannot both be remote.   What other workarounds/commands I could use to achieve similar results?
87711
You've got three folders:   folder current, which contains your current files folder old, which contains an older version of the same files folder difference, which is just an empty folder   How do you compare old with current and copy the files which are different (or entirely new) in current to difference?    I have searched all around and it seems like a simple thing to tackle, but I can't get it to work in my particular example. Most sources suggested the use of rsync so I ended up with the following command:  rsync -ac --compare-dest=../old/ new/ difference/   What this does however, is copies all the files from new to difference, even those which are the same as in old.  In case it helps (maybe the command is fine and the fault lies elsewhere), this is how I tested this:   I made the three folders. I made several text files with different contents in old. I copied the files from old to new. I changed the contents of some of the files in new and added a few additional files. I ran the above command and checked the results in difference.   I have been looking for a solution for the past couple of days and I'd really appreciate some help. It doesn't necessarily have to be using rsync, but I'd like to know what I'm doing wrong if possible.
26282
My goal is copy only all files from ~/local_dir to user@host.com /var/www/html/target_dir using scp and do not create local_dir category in local_dir.   /var/www/html/target_dir/files..   but not   /var/www/html/target_dir/local_dir/files.. when use -r parameter
95333
Does anyone have a eloquent way of stacking multiple .tif files into a multiple band stack using Rasterio and/or GDAL?  I am looking for a way to avoid using a subprocess command like gdal_merge.py and rather have it as part of my python script.  I know that both Rasterio and GDAL read the .tif files as arrays, but how do I stack those arrays and write out the result as separate bands?
54956
I am trying to export existing raster layers as tif files. I just want to avoid saving each raster manually. this is the code I am trying to use, but it doesn't seem to work:  from PyQt4.QtCore import * from qgis.core import * from qgis.gui import * import os import sys  layers = iface.layerTreeView().selectedLayers() for layer in layers:     output='Desktop'%layer.name%'.tif'   As specified in a comment below, I modified my code to this:  from PyQt4.QtCore import * from qgis.core import * from qgis.gui import * import os import sys   layers = iface.layerTreeView().selectedLayers()  for layer in layers:      file_name = 'D:\tif' + layer.name() + '.tif'      file_writer = QgsRasterFileWriter(file_name)      pipe = QgsRasterPipe()      provider = layer.dataProvider()       if not pipe.set(provider.clone()):         print "Cannot set pipe provider"      continue       file_writer.writeRaster(         pipe,         provider.xSize(),         provider.ySize(),         provider.extent(),         provider.crs())   I can't seem to get it to work and I am not getting any error.  I already selected the layers and it still does not work.
73727
I'm interested in combining the files from three Macs by copying the files from each one into a single folder hierarchy of my design on an external hard drive.  In my past experience copying files in OSX, sometimes the files lose their Created and Modified timestamps; i.e. they are changed to the present moment when the file copy happens.  How can I make sure this doesn't happen?
13373
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 off the remote path, where will rsync put the file? Eg:  rsync -av /home/ME/myfile user@remoteserver
53311
Assuming file2 already exists, the command   &gt; file1 &lt; file2 cat   appears to be copying the content of file2 to file1.  But I cannot understand this structure.  I understand that "Nothing" is being directed to file1 (creating or erasing its content). Then the content of file2 is being directed to file1.  Why is cat after file2? How does it know to cat file2 if the operands are not in the correct order?
119366
Is there any tool available to sync files between two or more linux servers immediately after writing the file in the disk? The rsync command does not suit me on this, because if I set rsync in cron, the minimum time I can set is 1 minute, but I need it on real-time basis.
42885
I am trying to copy a folder to remote Ubuntu server using command line ssh connection, i understand it's doable to transfer a file using scp but i have many files in a folder iam trying to copy to that remote server, how is that done? anyone?  Thank you.
93290
I'm using SyncToy 1.4 and it would be fine for what I need except that:    It can't handle the assigned drive letter changing between systems (e.g. syncing a USB drive),  it leaves its own (hidden) files in the folders being synched (is this a limitation of the OS/FS?),  it recreates empty folders for ones that have been deleted,  it syncs new sub folders in folders that have been unselected from syncing  and sometimes finds all the files have changed when they are still the same as they were. it can't handle very long file path/name   SyncToy 2.1 is too slow to be usable. Especially when run again on a folder without any changes it will start from scratch scanning all the files and sub-folders for differences.   It has to be a solution without using Internet based storage, as this isn't always available and otherwise can be far too slow. I'd prefer something that doesn't add its own files to the folders to be synched, and something with which it's quick and easy to change file and folder synching selections. When run the less interactive the better, ideally safely synching multiple folder pairs with a couple of mouse clicks (as SyncToy does).  Do I have to use rsync and batch files? Something with a GUI for granny to use without difficulty, would be better. Here's my criteria:    There is no requirement for an Internet connection. It must not create it's own housekeeping files/folders in either source or target (maybe this has to be done because of a shortcoming of NTFS?) Test: Source folder with two none-empty sub-folders A and B. Move sub-folder B into sub-folder A, does it duplicate this in the target folder? Test: Rename a file in sub-folder A, does it duplicate this in the target folder?  Can multiple folder pair syncs be done at the same time with only one or two mouse clicks? Does it have an option for previewing the changes it's about to make? Does it allow easy changing of source and/or target paths? It must be quick, (especially if re-scanning two folder trees with nothing changed). Test: Sync USB drive on PC 1 then copy files and folders from USB drive to PC 2, change folders and files on PC 2 (while those on PC 1 stay the same), sync USB drive on PC 2 and then re-sync the files and folders on PC 1 from the USB drive. Can it do this without any errors? Excluding installation, can granny use it comfortably? -->
82404
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' --exclude='*' /tmp/src/ /tmp/dest/   But it doesn't work.  What am I missing?  I also followed the answer to  but it didn't help.
66160
I can run this command from my command line prompt:  cp -r folder/!(exclude-me) ./   To recursively copy all contents of folder except for the subdirectory named exclude-me into the current directory.  This works exactly as intended.  However, I need this to work in a bash script I've written, where I have this:  if [ -d "folder" ]; then   cp -r folder/!(exclude-me) ./   rm -rf folder fi   But when I run the script:  bash my-script.sh   I get this:  my-script.sh: line 30: syntax error near unexpected token `(' my-script.sh: line 30: `  cp -r folder/!(exclude-me) ./'   And I'm at a loss as to why it works from the command prompt, but the exact same line doesn't work in a bash script.