Tag Info

Hot answers tagged

7

You want to use the -s|--protect-args option to rsync. Without it, the part after the : is passed as is to the remote shell so you can use constructs of that shell to build the list to transfer. That way, if you know the remote shell is zsh for instance, you can do: rsync host:'*(.)' there to transfer only regular files. Or with csh/bash/zsh/ksh: rsync ...


7

Restrict the commands that can be invoked by the key If an SSH key is going to be used by any kind of automated or unattended task, you should restrict what commands it is able to execute on a remote machine, no matter what decision you make about how and where to store the key. Use something like this in ~/.ssh/authhrized_keys: ...


6

There's a reason all those utilities use recursive directory traversal to discover changed files. There isn't any better way. Inotify exists, but does AFAIK not scale to several thousand directories. Not only that, but you have to listen continuously (say, as a daemon) and if you miss a single update then you have to recheck everything. Ain't there ...


4

Your idea is right. Here is a test: /foo$ stat -c '%i-%n' * 658846-egg 656129-spam 656129-test /bar$ rsync -av /foo/ . sending incremental file list ./ egg spam test sent 229 bytes received 76 bytes 610.00 bytes/sec total size is 0 speedup is 0.00 /bar$ stat -c '%i-%n' * 657110-egg 663431-spam 663560-test /bar$ rsync -Hav --delete-delay /foo/ . ...


3

Your expressions exclude the contents of the directories (/foo/*), not the directories themselves (/proc). For example: $ mkdir -p foo/{1..3}/{1..3} $ cat exclude.txt /1/* /2 $ rsync -avH --exclude-from=exclude.txt foo/ bar sending incremental file list created directory bar ./ 1/ 3/ 3/1/ 3/2/ 3/3/ sent 296 bytes received 89 bytes 770.00 bytes/sec total ...


3

Try the below one, I tested this and it is working. You should quote your destination path with ' or " and you should escape the ( and ). rsync -azR output.mp4 user@server.com:'encoded/somepath/DRRS_\(H264\).mp4' UPDATE: Call your script as below, ./sample.sh "encoded/somepath/DRRS_\(H264\).mp4" sample.sh #!/bin/bash rsync -azR output.mp4 ...


2

The reason youd use rsync to sync from ServerA -> ServerB is if users/services need access to the files on the ServerB system. If it's purely for backup as is suggested and users don't need access to read the files then why use rsync? Tar has incremental options and you can pipe it over the network as you would with rsync. ...


2

The sftp command is very limited. If you can't make it do what you want, you can use another approach, which is to mount the remote directory with the SSHFS filesystem. SSHFS uses SFTP as the transport protocol, so the server side just sees an SFTP client. You need to be able to use FUSE on the client side. With SSHFS, you mount the remote directory onto an ...


2

You need to both quote the path and use a backslash to escape parentheses in the remote path. Either single or double quotes will work. rsync -azR output.mp4 user@server.com:"encoded/somepath/DRRS_\(H264\).mp4" OR rsync -azR output.mp4 user@server.com:'encoded/somepath/DRRS_\(H264\).mp4'


2

If you want to skip the unreadable files: find /external/hd/folder ! -readable -print >unreadable_files rsync -a --exclude-from=unreadable_files /external/hd/folder/ /local/folder This assumes that you're using GNU find, and that your filenames don't have embedded newlines. If you want to copy all files, regardless of whether they are readable or not ...


1

You're trying to do too much with rsync. The first thing to do is to produce the list of all the MP3 files. find Music -type f -iname '*.mp3' Then convert the list of files into a list of the directories that contain the files. sed 's:/[^/]*$::' Eliminate any duplication of directories in the list. sort -u Now you have the list of directories you ...


1

If you mount the external HDD to your system locally, then it's not remote. Unless I misunderstood and your HDD is running a rsync daemon and say, connecting over a network? But forget that, can you just mount the drive locally and as @mjturner says, all you need to do is make sure you run rsync as root and it's a direct copy sudo rsync -a ...


1

The dir command within sftp client does not support redirection. Example below, showing how it does nothing. sftp> pwd Remote working directory: /var/tmp/foodir sftp> lcd /var/tmp/foodir sftp> dir *.* foo.txt sftp> dir *.* >dirlist.txt foo.txt sftp> dir foo.txt sftp> Man page for sftp confirms. ls [-1afhlnrSt] [path] ...


1

I'm assuming by parent folder you just mean the folder with filename.txt. You can get find to print this folder name with -printf '%h\n' instead of the -exec. You can pipe this into a shell loop or xargs for example: find /path/ -name "filename.txt" -type f -mtime -2 -printf '%h\n' | xargs -i rsync ... {} /destination \; I think you need to add -R to ...


1

In case you don't want to mess with your local ~/.ssh/config file and the --no-motd option is not working for you either, I had success setting the RSYNC_RSH env variable. RSYNC_RSH="ssh -q" rsync You may also try to use the rsync option -e rsync -e 'ssh -q'



Only top voted, non community-wiki answers of a minimum length are eligible