Completion script to rsync files from seedbox
Posted: Thu May 19, 2011 9:19 am
I've been working on a download completion script that checks if a remote host is online and if so, rsyncs the file over and then marks it for removal from transmission once the seed ratio is reached (by another cron script). Or If the remote host is down it adds the torrent details to a queue file.
My only problem so far is that rsync is a complete pain when dealing with paths that have spaces in them
for example: /home/user/Folder One/folder two/file.or.folder
sends the file over to /home/$REMOTEUSER/Folder where Folder is the actual file.
sends the file over but then rsync tries to rename it to whatever it's supposed to be called the remote host doesn't know what $TR_TORRENT_DIR and $TR_TORRENT_NAME so tries to rename it to "/" and fails
I've also tried padding $TR_TORRENT_DIR etc with the escape characters or replacing the spaces with ? marks but then rsync interprets them directly as "\ " or "?" and cannot find file "/home/user/Folder\ One/..." or "/home/user/Folder?One/..."
i've trolled around the rsync man-page 'til i'm blue in the fingers and have come up empty.
single & double quotes aren't working unless i don't use a variable. if i type it out manually it works great in both instances.
escaped quotes don't work at all.
question marks for the spaces don't work either
so aside from this not being directly transmission related, any ideas on how to convince rsync to behave?
My only problem so far is that rsync is a complete pain when dealing with paths that have spaces in them
for example: /home/user/Folder One/folder two/file.or.folder
Code: Select all
rsync -acKPqrze ssh --timeout 30 "$TR_TORRENT_DIR/$TR_TORRENT_NAME" $REMOTEUSER@$REMOTEHOST:"$TR_TORRENT_DIR/$TR_TORRENT_NAME"
Code: Select all
rsync -acKPqrze ssh --timeout 30 "$TR_TORRENT_DIR/$TR_TORRENT_NAME" $REMOTEUSER@$REMOTEHOST:'"$TR_TORRENT_DIR/$TR_TORRENT_NAME"'
I've also tried padding $TR_TORRENT_DIR etc with the escape characters or replacing the spaces with ? marks but then rsync interprets them directly as "\ " or "?" and cannot find file "/home/user/Folder\ One/..." or "/home/user/Folder?One/..."
i've trolled around the rsync man-page 'til i'm blue in the fingers and have come up empty.
single & double quotes aren't working unless i don't use a variable. if i type it out manually it works great in both instances.
escaped quotes don't work at all.
question marks for the spaces don't work either
so aside from this not being directly transmission related, any ideas on how to convince rsync to behave?