Matt McCutchen wrote:
- Filenames with newlines will get mangled.
- Hard links will be broken.
- If a file is changed while the script is working on it, it may be
clobbered with the old contents. Similarly, if it is moved, it may
reappear in the old location.
- Timestamps on directories will be modified.
The process should really be run using boot media, not on a live
filesystem. This avoids the issue of manipulating the /bin/mv being
Here's the approach I would use, starting in the filesystem root:
(GLOBIGNORE=TEMP; mv * TEMP)
rsync -aAXH --remove-source-files TEMP/ .
rm -rf TEMP
I agree with this approach.
Better yet, copy everything on another disk, format and copy back again
with compression enabled, so everything is well physically packed in the
first (faster) part of the disk. Or, BTW, is the btrfs defragmenter
good enough to let it do he job later?
You just taught me what GLOBIGNORE is for. Thanks.
It is anyway useless. I often do things like:
mkdir OLD; mv * OLD
and it works, with just a "can't move OLD inside itself" warning.
Roberto Ragusa mail at robertoragusa.it