Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting the RM command to a certain number?

Status
Not open for further replies.

rye8261

Technical User
Jul 6, 2003
359
0
0
US
I have a problem where I have a ton of files in a folder and I can't delete them. Every time I use the RM command on the folder to delete all the files I get kicked out of my ssh connection.

Is there a way to limit the RM command to say 500 files?

 
You can't delete all the files and folder with rm is because the argument list is too long. You need to use xargs to break it down into smaller chunks. There was a discussion here not too long ago.

Code:
find . | xargs rm -rf

--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top