5

Delete directory conditioned

view full story
linux-howto

http://www.unix.com – Hi, I am trying to make a script that finds if inside a folder there are more than 2 subfolders; if so, I want to erase the older subfolder. I thought this would be useful: Code: find /sdcard/backup -mtime +1 -exec rm-r {} /; But it only erases subfolders older than one day, and I would want that subfolders get erased if there are more than two, even if none of them is older than one day. How could I modify the command? Thanks for your help. Edit: Sorry, didn't use code tags Moderator's Comments: (HowTos)