How to Delete All files in a Folder [Linux:Argument list too long] Centos 7

Many times your tmp folder on your VPS or dedicated server may be full and prevents you from performing sessions related activities on your website, its important at that point that you clear off the tmp folder, dont worry, you can delete the whole content of that folder. At those times, if you try your regular rm -rf /tmp/* , you would get a linux error Argument list too long. , in this case you would need to use the Find command, which has a delete option,

find /tmp/ -type f -delete

The above code will safely delete the whole content of your tmp directory. if you need to delete large files in any directory, simply replace the tmp with the path to folder and it will do the magic

find /path/to/folder/ -type f -delete
delete large number of files linux

If you have other efficient ways of doing this, please share in the comment section.

This Post was brought to you by CloudHost, Domain name, Dedicated servers, VPS, Linux Windows Email Hosting that you can trust

Leave a Reply

Your email address will not be published.

(Required)

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com