I need to find a very efficient way of moving a file of matching -mtime from one directory tree to another directory, maintaining the same subdirectory path where it doesn't exist yet.

eg. move /dirA/subdir1/subdir2/filename to /dirB/subdir1/subdir2/filename

where subdir1/subdir2 may or may not yet exist under dirB/ at time of move.

And efficient meaning completing this on a tree of several million files before the next ice age (preferably sub-24 hrs).

Rsync comes to mind but some say it's not all that efficient for such matching single-file calls.

If this is in the same journaled filesystem, is a file move just a manipulation of filesystem catalogue metadata and not actual block re-writes, thus being that much more efficient?

1 Answer 1


Benchmark rsync. If it doesn't pan out, try:

find /dirA -mtime $whatever -print |
  xargs tar -cpf - |
  { cd /dirB && tar -xvf -; }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .