[Wylug-discuss] Moving files incrementally

Paul Brook paul at codesourcery.com
Wed Oct 3 23:23:25 UTC 2012


> I have a question about a very basic Linux functionality: moving files! But
> unfortunately neither Gnome or "mv" seemed to have the mode I need.
> 
> I have my data in an eCryptFS encrypted folder, but want to move it over to
> encFS. I have both folders mounted and can move the files now, but I was
> running into one problem: I don't have space enough! Unfortunately ever
> move command across file system boundaries seems to first copy everything,
> then delete the source.
> 
> Is there a way to move the files incrementally? I know that when something
> is moving and deleting file-by-file, there is a risk to have an
> half-finished state, but I guess it wouldn't be the end of the world, as
> you can simply issue the command again, as long as it merges directories.

I doubt there exists any standard recipe for dowing this. It's a pretty 
obscure requirement - in practice if you end up in this situation then you're 
probably doing something else wrong.

That said, a basic implementation using find, mv and possibly xargs should be 
fairly straightforward[1].  The trick is probably to create the whole 
directory structure first, then worry about the individual files.  If you have 
multiple users and varied permisions then a little more care is required.

Paul

[1] e.g. (not tested at all):
find . -type d -exec mkdir -p $dest/'{}' \;
find . -not -type d -exec mv '{}' $dest/'{}' \;



More information about the Wylug-discuss mailing list