Ubuntu server: Delete first folder in directory
Posted
by
Martin
on Server Fault
See other posts from Server Fault
or by Martin
Published on 2013-11-02T14:51:58Z
Indexed on
2013/11/02
21:59 UTC
Read the original article
Hit count: 268
How can I grab the first subfolder in a directory and delete it?
I found a script to monitor the free diskspace.
It sends an alert email if space runs low, but I want to also delete some unneeded stuff.
I have a backup folder where I save daily and monthly backups. I want to delete the first folder since this always the oldest, but I don't know the name of the oldest backup.
My folders without Jan-May and Dec:
06-01
07-01
08-01
09-01
10-01
11-01
Friday
Monday
Saturday
Sunday
Thursday
Tuesday
Wednesday
How can I delete the first folder "06-01" without knowing its name?
© Server Fault or respective owner