Skip to main content

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:

code:
for file in "$( /usr/bin/find /path/to/directory -type f -mtime +2 )"   /bin/rm -f $file done
this delete files in /path/to/directory older 2 days.

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

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support