mv -f ???jamesbond wrote:s7 is much faster but doesn't cope very well when savefile is almost full (because it copy before delete)
Note: I never use a save file - just trying to help where I can without my puppypc available - sorry for the suggestions without real code
When I look at it, I see the possibility to combine all 3 loops into 1 and recurse the tree only once using a function that calls itself for directories.
oversimplified version
Code: Select all
case $1 in
blacklisted|dir|list)exit;;
*)dirstuff_here_now
for x in * do
[ -d $x ] && dirstuff_moved_out_of_loop && this_function $1/$x & || do_other_stuff
done
esac
...
but really that order is important, since the first check should really cover most cases so that further checks are unnecessary
the only easy way I can think of to check for .wh files faster is to think of them as an array of characters such that ${x:0:4} is equal to .wh. (cool eh?) so since this is a simple string comparison that does not have to access the file (slow) it should be first, then dir check (to start another thread quicker if necessary), then links (because it only needs 1 check)
dirstuff first
for x in ....
if .wh* do .wh stuff
else if dir recursively call this function
else if link do link stuff
else (must be a file) ... do file stuff
recursion always used to give me a headache, so let me know if you anything is not clear and I will try to clarify
EDIT: thinking about .wh. file issues the substrings could be used to check for real files ${x:4} would be the name of the real file such that
[ -e ${DIR}/${x:4} ] && echo file ${x:4} exists in ${DIR}