Top Hosting Forum

WebHosting Reviews Forum


Budget DirectAdmin hosting and domain names

How to empty folder in Linux -Guide - Argument list too long

Virtual Private Server Forum and Dedicated Server Forum - Discussion on dedicated server and VPS issues
Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting

Hosting Forum Description
Virtual Private Server Forum and Dedicated Server Forum - Discussion on dedicated server and VPS issues

How to empty folder in Linux -Guide - Argument list too long

Postby hostingforum » Wed Aug 22, 2012 6:31 am

Received "-bash: /usr/bin/find: Argument list too long" message when tried to empty folder with large number of files?

There is a solution and it worked on my centos server! Go to folder you want to empty (delete all files in it).

example: cd /home/folder/folder/

Then paste this command:

find . -name "*" -print | xargs rm

When executed, it told me "rm: cannot remove `.' or `..'"
But i left it running untill comand line appeared again and all files from that folder (/home/folder/folder/) was deleted. (You can confirm this when you do "ls" command after deleting is complete)

Ensure you are in right folder you want to empty and if you are not sure what you are doing, backup the folders first.



Ad: There You can have your forum site-wide banner/text ad for $99 yearly. Contact admin


User avatar
hostingforum
Site Admin
 
Posts: 656
Joined: Fri May 20, 2011 7:58 pm
Location: Czech Republic

Return to VPS & Dedicated Server Forum

Who is online

Users browsing this forum: No registered users and 2 guests

.