2008 Feb 07 - Thu
Bash Script to Large Number of Files
Not knowing any other way to remove a large number of similarily named
files from a directory (such as netflow files), and not wanting to do it
manually, the following one liner creates something to start with:
ls -1 -A ft | sed "s/^/rm ft\//" > d.sh
It does a directory listing with one column, and does not include the '.' and '..'
entries. It then uses sed (stream editor> to insert a rm command at the
beginning of each line. The results are written out to a file for further tweaking.
chmod +x d.sh
will make the script executable.
[/OpenSource/Linux]
permanent link
|