Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Need a ss search and delete script (http://www.greenguysboard.com/board/showthread.php?t=27866)

CelticTiger 2006-01-12 12:07 AM

Need a ss search and delete script
 
Does anyone know of any server side script that will search for and delete files of a certain type or name? It would make my life a hell of alot easier for a certain task I have in mind. Any help would be greatly appreciated.

Chop Smith 2006-01-12 03:00 AM

I am sure that either cd34 or Cleo post a link to a script months ago. I can not find it by searching. If so, I am sure they will give you an answer in the AM

cd34 2006-01-12 04:31 AM

find . -type f -name \*.wmv -print | awk '{ print "rm \"" $1 \"" }' | sh

that will delete them if they include spaces, (, ), and other punctuation characters.

you could use xargs, but, if the list is long enough, xargs will say, too many arguments.

index4\*.html (would get rid of all files starting with index4 and ending with .html)

needs the \ in there.

CelticTiger 2006-01-12 11:54 AM

Thanks a bunch Chop and cd34.....
Before you answered cd34 I I did find the following: find /path/to/dir -iname "*.txt" -exec rm {} \; which seems to work well as well. Thanks again!


All times are GMT -4. The time now is 02:12 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc