On Sat, 2010-05-01 at 05:32 +0200, Kevin Kofler wrote: > Adam Jackson wrote: > > find / -xdev -type f | while read i; do > > cp $i /tmp/tmp > > rm $i > > mv /tmp/tmp $i > > done > > I presume that cp should be cp -p? "cp --preserve=all" is needed to preserve SELinux context and extended attributes. > And I guess it would be better to do a mv > -f rather than rm + mv, otherwise you're going to have trouble when you hit > /bin/mv. :-) And of course this needs to run as root. > > > Obviously, don't actually run that. > > Well, are there any other caveats than the ones I listed above? - 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. The process should really be run using boot media, not on a live root filesystem. This avoids the issue of manipulating the /bin/mv being used. Here's the approach I would use, starting in the filesystem root: mkdir TEMP (GLOBIGNORE=TEMP; mv * TEMP) rsync -aAXH --remove-source-files TEMP/ . rm -rf TEMP -- Matt -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel