GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   question for server guru---how to delete folder with many files (https://gfy.com/showthread.php?t=398490)

latinasojourn 12-05-2004 01:32 PM

question for server guru---how to delete folder with many files
 
i want to do some cleanup on our servers.

specifically delete the folders that contain several hundred thousand small jpg files of TGP thumbs.

i will use SSH

now when i use regular "rm" command it times out.

what's the easy way to do this---what is the command line?

(delete the folder and all files in it---there might be 100K individual small jpg files within the "thumbs" folder)

thanks to anyone who knows!

X37375787 12-05-2004 01:34 PM

rm -rf folder/

???

AndrewKanuck 12-05-2004 01:34 PM

rm -rf foldername

If that gives you an error about too many files do it quick and dirty

bash
for i in `ls`
do
rm -rf $i
done

and wait

X37375787 12-05-2004 01:36 PM

dont see how rm-rf would have trouble with anything. you can delete your entire harddrive if you want with that command

AndrewKanuck 12-05-2004 01:36 PM

Quote:

Originally posted by AndrewKanuck
rm -rf foldername

If that gives you an error about too many files do it quick and dirty

bash
for i in `ls`
do
rm -rf $i
done

and wait

Quick note - only do that bash script inside the folder that you're trying to remove - don't do it from... say / or /home or anything crazy like that.

The smart thing would be to hire a server admin if you don't understand that concept tho :2 cents:

AndrewKanuck 12-05-2004 01:37 PM

Quote:

Originally posted by Equinox
dont see how rm-rf would have trouble with anything. you can delete your entire harddrive if you want with that command
I've had rm issues before where the filecount was too large - say if you were doing rm *.jpg - or in my case, I was deleting all locked messages in my spam folder (about 450,000 of them)

xenophobic 12-05-2004 01:39 PM

or just
find . -type f -exec rm {} \;

two curly braces replaced by stupid board.

you would have to do it in the directory you want all the files removed.

xenophobic 12-05-2004 01:43 PM

Quote:

Originally posted by Equinox
dont see how rm-rf would have trouble with anything. you can delete your entire harddrive if you want with that command
because the file count exceeds the maximum argument length from the kernel.

smashface 12-05-2004 01:46 PM

What about

cp /dev/null /folder

latinasojourn 12-05-2004 01:46 PM

thanks you guys.


OK, so in other words i,


cd to the thumbs directory


and then type the command below?:


rm -rf folder/

SinSational 12-05-2004 01:53 PM

yes, if you want to clean out /thumbs then do

rm -rf *

that will empty it

LikeWhoa! 12-05-2004 01:58 PM

MAKING SURE YOURE IN THE "THUMBS" DIR BEFORE YOU DO THE ABOVE


All times are GMT -7. The time now is 10:08 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123