0

I need help with a script that deletes all but the newest -img directories.

Contents of /media/andy/MAXTOR_SDB2/

01-16-18-img  
2018-01-26-11-img  
Clonezilla_Images  
Family_Movies_AND_PICS  
lost+found  
MAXTOR_SDB2  
sdb2_listing.txt  
SDB2_Mountpoint  
3
  • Since you have just two -img folders, it's probably simplest to maually see which is newer and set GLOBIGNORE to that directory's name.
    – muru
    Jan 27, 2018 at 11:13
  • I don't see how GLOBIGNORE can work as those -img directories will have different names because of the dates in the file name.
    – fixit7
    Jan 27, 2018 at 16:45
  • If they didn't have different names they'd be the same directory, I'd suppose.
    – muru
    Jan 27, 2018 at 16:55

0

Browse other questions tagged .