how to find the filename?

March 17, 2009 at 03:14:26
Specs: Linux
how to find the filename start with string "Load" in current directory and delete those files


See More: how to find the filename?

Report •

March 17, 2009 at 09:48:38
Using bash, this script removes all files starting with Load in the current directory on down the tree:

find . -type f -name "Load*" -print|xargs rm

If you only want to delete in the current directory and not proceed down the tree:

find . -type f -name "Load*" -print|grep -v '^./.*/.*'| xargs rm

The GNU find has a maxdepth option, but my version is more portable if you only want to perform maxdepth = 1 and ignore subdirectories.

Report •

March 18, 2009 at 02:32:31

Thanks Nails.

Report •

Related Solutions

Ask Question