Rsync issue with files with spaces.
Hi!
I am trying to write a script for my daily incremental backups with rsync, but I am having some trouble with files which have spaces in their name. I am executing the following command: Code:
# rsync -ravuz $(find "/home/mortuus/Documentos/" -mtime -7 -type f) /media/Multimedia/Backup/Debian/home_incre_$(date +%Y-%m-%d) Code:
rsync: link_stat "/home/mortuus/Documentos/Curriculum" failed: No such file or directory (2) Any ideas? Thanks in advance. |
I know wrapping things in quotes works, so maybe this will work;
Code:
# rsync -ravuz "$(find "/home/mortuus/Documentos/" -mtime -7 -type f)" /media/Multimedia/Backup/Debian/home_incre_$(date +%Y-%m-%d) |
Thanks for replying so fast.
I wrapped the first argument with quotes, and now I get the following error: Code:
root@normandy:~# rsync -ravuz "$(find "/home/mortuus/Documentos/" -mtime -7 -type f)" /media/Multimedia/Backup/Debian/home_incre_$(date +%Y-%m-%d) |
try this then (maybe in a script);
Code:
DATETIME=`date +%Y-%m-%d` |
Untested, but if not a great deal of files I am assuming you could use exec option??
Code:
find /home/mortuus/Documentos/ -mtime -7 -type f -exec rsync -ravuz "{}" /media/Multimedia/Backup/Debian/home_incre_$(date +%Y-%m-%d) \; |
Quote:
Oh, that should totally work! :) That's way better than my idea!! /posi-rep bump @Mortuus Hey, give grail's suggestion a shot! |
Thanks to both of you :)
I tried Grail suggestion and it worked perfectly! Thanks! This was getting me mad hehe I didn't know that find could exec commands, but it is a bit hard for understanding, I will search on google and on books why do you put "{}" Thanks again. I mark this as solved. |
Quote:
Basically, if you ran the find without the -exec, the brackets {}, and the terminator \;, then find will give you a list of directories. with -exec, the list of directories is stuffed inside {}, one by one. We need double-quotes around the {} because the file names have spaces. |
All times are GMT -5. The time now is 02:10 AM. |