Thread: Deleting files that meet certain criteria
hey there, hope you're doing great!
i'm here of course because know ssh command issue if need delete files meet criteria.
instance, in case, have files bear same name still have minor differences. logs.
let me give example:
l0619000.log
l0619001.log
l0619002.log
l0619003.log
l0619004.log
in bold i'd have removed, while "l0619004.log" left intact.
thank , have awesome day!![]()
if files want delete older other files, possible time-based, this:
this delete files in /path/to/directory older 2 days.code:for file in "$( /usr/bin/find /path/to/directory -type f -mtime +2 )" /bin/rm -f $file done
suggest take @ find man page:
code:man find
Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [ubuntu] Deleting files that meet certain criteria
Ubuntu
Comments
Post a Comment