Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17851

Is rsync the wrong answer to what I'm trying to accomplish?

$
0
0

My end goal is that I want to back up my phone's pictures to my NAS server, sorted by date (/yyyy/mm/dd/). I'm planning to use rsync backup for Android to copy the pics to the server every night into some sort of "staging" folder, and to then have a cron script move the files over into the desired subdirectories periodically, sorted by create date.

The problem I see with this is that if my cron script moves the files into their respective subdirectories, then the next time rsync runs on my phone, I'll end up re-copying ALL of the files from my phone every time rsync runs (since at this point the staging folder would be empty), which seems like a waste of time.

Does anyone have any ideas on how to avoid this? One idea I had was to have the cron script truncate each file in the staging folder to 0 bytes after it was copied and verified (rather than deleting it), which would let rsync on the phone know that the file exists already. (I haven't checked, but I'm assuming there's a way to tell rsync to only take filename and date into account when deciding whether or not to copy each file.) I'm confident that this would technically work, since my phone names every image uniquely by date/time taken (so name collisions are not a concern). But this seems like a really hacky way to accomplish it, and it "feels" wrong.

Any other ideas on how to accomplish it?

submitted by aphaelion
[link][21 comments]

Viewing all articles
Browse latest Browse all 17851

Trending Articles