![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto copy for files from folder to folder upon instant writing | Bashar | UNIX for Advanced & Expert Users | 2 | 08-21-2008 03:44 PM |
| Copying multiple folders to local machine (don't know folder names) | leenyburger | UNIX for Dummies Questions & Answers | 5 | 06-12-2008 08:38 AM |
| Batch delete specific folder from user home directories | nipodrom | Shell Programming and Scripting | 2 | 05-09-2008 07:22 AM |
| How can i delete files in folder by date? | kobibn | UNIX for Dummies Questions & Answers | 9 | 10-25-2007 07:04 PM |
| delete files and folders older than 3 days | melanie_pfefer | Shell Programming and Scripting | 7 | 12-18-2006 12:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
delete all folders/files and keep only the last 10 in a folder
Hi,
I want to write a script that deletes all folders and keep the last 10 recent folders. I know the following: ls -ltr will sort the folders from old to recent. ls -ltr | awk '{print $9}' will list the folder names (with a blank line at the beginning) I want to get the 10th folder from the bottom. HOW? Once I get it, I can run: find . ! -newer <this_object> -exec rm {} \; Thanks, PS: Any other suggestion is appreciated ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|