I wrote:
>Here's my 60-second rendition of a shell command that might
>serve the purpose described in the first item:
>(NOTICE: there's a tab character after the first '5' and
>after the '[0-9]*' sequence - not spaces..)
>
># Recursive descent starting from current directory, searching
># for files of (say) 5k and deleting them:
>
>du -kxa | sort -rn | sed -e '/^5        /,$d' -e 's/^[0-9]*     //' | while read 
>victim; do if [ -f $victim ]; then rm $victim; else echo $victim not a FILE; fi; done


Dang!  This is a good object-lesson about how you should always
be wary of slapdash hacks offered to you by strangers - it only
took me a few seconds to start seeing ways my approach could be
missing the mark:

 - It needs at least one file on the 5k range to be found.
 - It assumes that it's OK to zorch all files of 5k-and-greater.






>...and the second item might be accomplished (with some
>gotchas like destruction of files with identical basenames)
>as follows:
>
>find . -name "*.html" -exec mv '{}' desiredTargetDirectory ';'


And a better approach to my second hack might be something like:

find . -name "*.html" -print >/tmp/fileList
tar cvf - -T /tmp/fileList | (cd desiredTargetDirectory; tar xvf -)
rm /tmp/fileList


...which would move the files into their original tree-relative
locations in the new location.



I still spent a total of less than three minutes putting these
together, so test them in a safe place before using them in a
where valuable files live...


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to