You are not logged in.
before I write a shellscript myself, I was wondering if the following already exists:
a file/directory copying/moving tool (which preserves permissions, can copy directories recursively, etc), but:
1) if dest already exists, rename it first so that there is always a backup of whatever was there before.
2) if anything fails, I don't want src or dest in a bad shape. Either they have the correct data, or they don't. (although I wouldn't mind having dest.tmp or something so that I can resume the transfer later)
3) support copying on the same host, but also to remote hosts (over scp).
afaict, neither of scp and rsync support all this.
So i guess you could call this a "transactional" copy/move. Implementation wise, here's how I would do it:
1) if dest exists, mv dest dest.old<date>
2A) in case it's a move where src and dest are on the same filesystem, mv src dest
2B) all other cases: copy all data to dest.temp, and when that worked perfectly, mv dest.temp to dest
3) remove src if needed.
Last edited by Dieter@be (2010-09-05 15:32:23)
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
it doesn't seem to support sending to remote hosts.
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
it doesn't seem to support sending to remote hosts.
sshfs might take care of that?
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Dieter@be wrote:it doesn't seem to support sending to remote hosts.
sshfs might take care of that?
Meh, I prefer just running a tool
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
another one to try is unison tho' it won't fulfill all your needs.
Offline
I would say that rsync kind of does what you want with '-a --partial-dir=DIR --delete-after --partial'.
I use -a (which is equivalent to -rlptgoD) but you can use more or less switches, for me -a seems to work fine. However I never tried using '--partial-dir=DIR --delete-after' so I don't know how well it will work. The switch --delay-updates might also interest you as it will try to make changes more atomic.
Edit:
After re-re-reading the man page I have noticed that you may also want to look at the -b and --suffix=SUFFIX switches. If rsync does what you want, it will require a ton of switches, but I guess it's better than writing and debugging your own script.
Last edited by R00KIE (2010-09-13 21:41:22)
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
Thanks R00KIE, I'll need to investigate rsync further.
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline