C3rd
[Linux] Count Files and Delete Old Files
Posted: 15 Jun 2011, 10:41am - WednesdayHere's the command to count the files inside a specific directory under linux environment:
ls -1 <target path> | wc -lHere's the command to delete all files older than 60 days within specific directory:
find <target path> -mtime +60 -type f -exec rm -rf {} \;Here a sample to delete PNG files after 3 days.
find /home/proj/public_html/cache/ -mtime +3 -name '*.png' -type f -exec rm -rf {} \;It help a lot for file management combined with cron jobs.
Search
Categories
Related Links
- Apache Web Server
- ASP Immigration Services Ltd.
- CentOS Linux
- Color Scheme Picker
- CSS Button Generator
- Deviant Art Account
- Don Tabaniag - GraphiCult
- Jerson Maglasang Weblog
- Joshua Manlunas
- Mark "mungkey" Vicente
- Matt Arnilo Baluyos
- MySQL
- Paul Labis
- PHP
- PrendStar
- Ridvan Baluyos
- Scott Davies
- SEO Fart XML-RPC Ping Tool
- Stripes Generator
- The Hero
- Ubuntu Linux
- Vim Carlo Nabora (DA)
- Wella Maria Hong
- What is my IP?
- Xavier University - Ateneo de Cagayan
- Zabyer Community