how to delete files with specific date pattern [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite













This question already has an answer here:



  • How to delete old backups based on a date in file name?

    2 answers



Under the folder /var/log/roler_t, we have the following files:



-rw-r--r-- 1 roler smike 37652 Jun 25 01:44 2018-06-23T02:KJU:00
-rw-r--r-- 1 roler smike 41742 Jun 25 01:45 2018-06-21T20:KJU:00
-rw-r--r-- 1 roler smike 36762 Jun 25 01:46 2018-06-22T08:KJU:00
-rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
-rw-r--r-- 1 roler smike 42751 Jun 25 01:48 2018-06-21T16:KJU:00
-rw-r--r-- 1 roler smike 34627 Jun 25 01:49 2018-06-22T23:KJU:00
-rw-r--r-- 1 roler smike 59828 Jun 25 01:51 2018-06-23T05:KJU:00
-rw-r--r-- 1 roler smike 33561 Jun 25 01:52 2018-06-22T20:KJU:00
-rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
-rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00
-rw-r--r-- 1 roler smike 36643 Jun 25 01:53 2018-06-22T01:KJU:00


How can we remove only the files that are older than ten days and have a specific date pattern, for example 2018-06-23.



Expected results are as follows:



the following files will stay under /var/log/roler_t



-rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
-rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
-rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00









share|improve this question















marked as duplicate by Jeff Schaller, Romeo Ninov, RalfFriedl, Thomas, Thomas Dickey Sep 13 at 20:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















    up vote
    0
    down vote

    favorite













    This question already has an answer here:



    • How to delete old backups based on a date in file name?

      2 answers



    Under the folder /var/log/roler_t, we have the following files:



    -rw-r--r-- 1 roler smike 37652 Jun 25 01:44 2018-06-23T02:KJU:00
    -rw-r--r-- 1 roler smike 41742 Jun 25 01:45 2018-06-21T20:KJU:00
    -rw-r--r-- 1 roler smike 36762 Jun 25 01:46 2018-06-22T08:KJU:00
    -rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
    -rw-r--r-- 1 roler smike 42751 Jun 25 01:48 2018-06-21T16:KJU:00
    -rw-r--r-- 1 roler smike 34627 Jun 25 01:49 2018-06-22T23:KJU:00
    -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 2018-06-23T05:KJU:00
    -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 2018-06-22T20:KJU:00
    -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
    -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00
    -rw-r--r-- 1 roler smike 36643 Jun 25 01:53 2018-06-22T01:KJU:00


    How can we remove only the files that are older than ten days and have a specific date pattern, for example 2018-06-23.



    Expected results are as follows:



    the following files will stay under /var/log/roler_t



    -rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
    -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
    -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00









    share|improve this question















    marked as duplicate by Jeff Schaller, Romeo Ninov, RalfFriedl, Thomas, Thomas Dickey Sep 13 at 20:03


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite












      This question already has an answer here:



      • How to delete old backups based on a date in file name?

        2 answers



      Under the folder /var/log/roler_t, we have the following files:



      -rw-r--r-- 1 roler smike 37652 Jun 25 01:44 2018-06-23T02:KJU:00
      -rw-r--r-- 1 roler smike 41742 Jun 25 01:45 2018-06-21T20:KJU:00
      -rw-r--r-- 1 roler smike 36762 Jun 25 01:46 2018-06-22T08:KJU:00
      -rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
      -rw-r--r-- 1 roler smike 42751 Jun 25 01:48 2018-06-21T16:KJU:00
      -rw-r--r-- 1 roler smike 34627 Jun 25 01:49 2018-06-22T23:KJU:00
      -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 2018-06-23T05:KJU:00
      -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 2018-06-22T20:KJU:00
      -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
      -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00
      -rw-r--r-- 1 roler smike 36643 Jun 25 01:53 2018-06-22T01:KJU:00


      How can we remove only the files that are older than ten days and have a specific date pattern, for example 2018-06-23.



      Expected results are as follows:



      the following files will stay under /var/log/roler_t



      -rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
      -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
      -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00









      share|improve this question
















      This question already has an answer here:



      • How to delete old backups based on a date in file name?

        2 answers



      Under the folder /var/log/roler_t, we have the following files:



      -rw-r--r-- 1 roler smike 37652 Jun 25 01:44 2018-06-23T02:KJU:00
      -rw-r--r-- 1 roler smike 41742 Jun 25 01:45 2018-06-21T20:KJU:00
      -rw-r--r-- 1 roler smike 36762 Jun 25 01:46 2018-06-22T08:KJU:00
      -rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
      -rw-r--r-- 1 roler smike 42751 Jun 25 01:48 2018-06-21T16:KJU:00
      -rw-r--r-- 1 roler smike 34627 Jun 25 01:49 2018-06-22T23:KJU:00
      -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 2018-06-23T05:KJU:00
      -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 2018-06-22T20:KJU:00
      -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
      -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00
      -rw-r--r-- 1 roler smike 36643 Jun 25 01:53 2018-06-22T01:KJU:00


      How can we remove only the files that are older than ten days and have a specific date pattern, for example 2018-06-23.



      Expected results are as follows:



      the following files will stay under /var/log/roler_t



      -rw-r--r-- 1 roler smike 51764 Jun 25 01:47 PL-06-23T12:KJU:00
      -rw-r--r-- 1 roler smike 59828 Jun 25 01:51 JFG:KJU:00
      -rw-r--r-- 1 roler smike 33561 Jun 25 01:52 PL-22T20:KJU:00




      This question already has an answer here:



      • How to delete old backups based on a date in file name?

        2 answers







      linux shell-script find regular-expression






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 13 at 14:36









      Patrick Mevzek

      2,0581721




      2,0581721










      asked Sep 13 at 11:45









      yael

      2,0391345




      2,0391345




      marked as duplicate by Jeff Schaller, Romeo Ninov, RalfFriedl, Thomas, Thomas Dickey Sep 13 at 20:03


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by Jeff Schaller, Romeo Ninov, RalfFriedl, Thomas, Thomas Dickey Sep 13 at 20:03


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          You can filter your files by date with the find command.



          For example:



          find /var/log/roler_t -mtime +10


          returns all files with modification date > 10 days.



          Similarly you can use flags like -atime (access time), -ctime (status change time), but I think -mtime is what you're looking for.



          If you want to remove them with a single command (but I suggest you always check before if the results of find are what you're expecting):



          find /var/log/roler_t -mtime +10 -exec rm ;





          share|improve this answer




















          • not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
            – yael
            Sep 13 at 11:56











          • the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
            – yael
            Sep 13 at 12:01










          • @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
            – Mr Shunz
            Sep 13 at 12:11


















          up vote
          0
          down vote













          This is similar to your earlier question, you can achieve this by the following



          $ find /var/log/roler_t -mtime +10 -name "XXXX-XX-XX*"


          where XXXX-XX-XX is the datestamp you are looking for. If you know that the year month and day correspond to the modification time you are looking for you coul change the argument to the -name option to be something like this:



          $find /var/log/roler_t -mtime +10 -name "`date -d'now - 10 days' +'%y-%m-%d'*"


          to automatically generate the filename prefix, though you may need to play with the date command number of days you subtract to be sue the mtime and the datestamp match what you need.



          If you just want to match the names of files that begin with a datestamp like string, e.g. '2018-09-13' then use the following:



          /var/log/roler_t -mtime +10 -name "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*"





          share|improve this answer






















          • but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
            – yael
            Sep 13 at 12:16











          • @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
            – B.McCready
            Sep 13 at 12:20











          • yes thats I mean
            – yael
            Sep 13 at 12:30










          • @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
            – michael
            Sep 13 at 12:31










          • so can you please update the answer , instead the remark so I will choose the right answer
            – yael
            Sep 13 at 12:33

















          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          You can filter your files by date with the find command.



          For example:



          find /var/log/roler_t -mtime +10


          returns all files with modification date > 10 days.



          Similarly you can use flags like -atime (access time), -ctime (status change time), but I think -mtime is what you're looking for.



          If you want to remove them with a single command (but I suggest you always check before if the results of find are what you're expecting):



          find /var/log/roler_t -mtime +10 -exec rm ;





          share|improve this answer




















          • not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
            – yael
            Sep 13 at 11:56











          • the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
            – yael
            Sep 13 at 12:01










          • @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
            – Mr Shunz
            Sep 13 at 12:11















          up vote
          0
          down vote













          You can filter your files by date with the find command.



          For example:



          find /var/log/roler_t -mtime +10


          returns all files with modification date > 10 days.



          Similarly you can use flags like -atime (access time), -ctime (status change time), but I think -mtime is what you're looking for.



          If you want to remove them with a single command (but I suggest you always check before if the results of find are what you're expecting):



          find /var/log/roler_t -mtime +10 -exec rm ;





          share|improve this answer




















          • not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
            – yael
            Sep 13 at 11:56











          • the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
            – yael
            Sep 13 at 12:01










          • @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
            – Mr Shunz
            Sep 13 at 12:11













          up vote
          0
          down vote










          up vote
          0
          down vote









          You can filter your files by date with the find command.



          For example:



          find /var/log/roler_t -mtime +10


          returns all files with modification date > 10 days.



          Similarly you can use flags like -atime (access time), -ctime (status change time), but I think -mtime is what you're looking for.



          If you want to remove them with a single command (but I suggest you always check before if the results of find are what you're expecting):



          find /var/log/roler_t -mtime +10 -exec rm ;





          share|improve this answer












          You can filter your files by date with the find command.



          For example:



          find /var/log/roler_t -mtime +10


          returns all files with modification date > 10 days.



          Similarly you can use flags like -atime (access time), -ctime (status change time), but I think -mtime is what you're looking for.



          If you want to remove them with a single command (but I suggest you always check before if the results of find are what you're expecting):



          find /var/log/roler_t -mtime +10 -exec rm ;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 13 at 11:53









          Mr Shunz

          2,65811720




          2,65811720











          • not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
            – yael
            Sep 13 at 11:56











          • the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
            – yael
            Sep 13 at 12:01










          • @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
            – Mr Shunz
            Sep 13 at 12:11

















          • not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
            – yael
            Sep 13 at 11:56











          • the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
            – yael
            Sep 13 at 12:01










          • @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
            – Mr Shunz
            Sep 13 at 12:11
















          not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
          – yael
          Sep 13 at 11:56





          not as I ask , I mean to delete all files with name date syntax as xxxx-xx-xx , and that older then 10day
          – yael
          Sep 13 at 11:56













          the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
          – yael
          Sep 13 at 12:01




          the syntax find /var/log/roler_t -mtime +10 -exec rm ; , will remove also the file as PL-22T20:KJU:00
          – yael
          Sep 13 at 12:01












          @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
          – Mr Shunz
          Sep 13 at 12:11





          @yael as @B.McCready answered, then just filter by filename, too adding -name "*XXXX-XX-XX*" to the find` command.
          – Mr Shunz
          Sep 13 at 12:11













          up vote
          0
          down vote













          This is similar to your earlier question, you can achieve this by the following



          $ find /var/log/roler_t -mtime +10 -name "XXXX-XX-XX*"


          where XXXX-XX-XX is the datestamp you are looking for. If you know that the year month and day correspond to the modification time you are looking for you coul change the argument to the -name option to be something like this:



          $find /var/log/roler_t -mtime +10 -name "`date -d'now - 10 days' +'%y-%m-%d'*"


          to automatically generate the filename prefix, though you may need to play with the date command number of days you subtract to be sue the mtime and the datestamp match what you need.



          If you just want to match the names of files that begin with a datestamp like string, e.g. '2018-09-13' then use the following:



          /var/log/roler_t -mtime +10 -name "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*"





          share|improve this answer






















          • but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
            – yael
            Sep 13 at 12:16











          • @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
            – B.McCready
            Sep 13 at 12:20











          • yes thats I mean
            – yael
            Sep 13 at 12:30










          • @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
            – michael
            Sep 13 at 12:31










          • so can you please update the answer , instead the remark so I will choose the right answer
            – yael
            Sep 13 at 12:33














          up vote
          0
          down vote













          This is similar to your earlier question, you can achieve this by the following



          $ find /var/log/roler_t -mtime +10 -name "XXXX-XX-XX*"


          where XXXX-XX-XX is the datestamp you are looking for. If you know that the year month and day correspond to the modification time you are looking for you coul change the argument to the -name option to be something like this:



          $find /var/log/roler_t -mtime +10 -name "`date -d'now - 10 days' +'%y-%m-%d'*"


          to automatically generate the filename prefix, though you may need to play with the date command number of days you subtract to be sue the mtime and the datestamp match what you need.



          If you just want to match the names of files that begin with a datestamp like string, e.g. '2018-09-13' then use the following:



          /var/log/roler_t -mtime +10 -name "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*"





          share|improve this answer






















          • but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
            – yael
            Sep 13 at 12:16











          • @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
            – B.McCready
            Sep 13 at 12:20











          • yes thats I mean
            – yael
            Sep 13 at 12:30










          • @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
            – michael
            Sep 13 at 12:31










          • so can you please update the answer , instead the remark so I will choose the right answer
            – yael
            Sep 13 at 12:33












          up vote
          0
          down vote










          up vote
          0
          down vote









          This is similar to your earlier question, you can achieve this by the following



          $ find /var/log/roler_t -mtime +10 -name "XXXX-XX-XX*"


          where XXXX-XX-XX is the datestamp you are looking for. If you know that the year month and day correspond to the modification time you are looking for you coul change the argument to the -name option to be something like this:



          $find /var/log/roler_t -mtime +10 -name "`date -d'now - 10 days' +'%y-%m-%d'*"


          to automatically generate the filename prefix, though you may need to play with the date command number of days you subtract to be sue the mtime and the datestamp match what you need.



          If you just want to match the names of files that begin with a datestamp like string, e.g. '2018-09-13' then use the following:



          /var/log/roler_t -mtime +10 -name "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*"





          share|improve this answer














          This is similar to your earlier question, you can achieve this by the following



          $ find /var/log/roler_t -mtime +10 -name "XXXX-XX-XX*"


          where XXXX-XX-XX is the datestamp you are looking for. If you know that the year month and day correspond to the modification time you are looking for you coul change the argument to the -name option to be something like this:



          $find /var/log/roler_t -mtime +10 -name "`date -d'now - 10 days' +'%y-%m-%d'*"


          to automatically generate the filename prefix, though you may need to play with the date command number of days you subtract to be sue the mtime and the datestamp match what you need.



          If you just want to match the names of files that begin with a datestamp like string, e.g. '2018-09-13' then use the following:



          /var/log/roler_t -mtime +10 -name "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*"






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 13 at 16:04

























          answered Sep 13 at 12:09









          B.McCready

          663




          663











          • but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
            – yael
            Sep 13 at 12:16











          • @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
            – B.McCready
            Sep 13 at 12:20











          • yes thats I mean
            – yael
            Sep 13 at 12:30










          • @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
            – michael
            Sep 13 at 12:31










          • so can you please update the answer , instead the remark so I will choose the right answer
            – yael
            Sep 13 at 12:33
















          • but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
            – yael
            Sep 13 at 12:16











          • @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
            – B.McCready
            Sep 13 at 12:20











          • yes thats I mean
            – yael
            Sep 13 at 12:30










          • @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
            – michael
            Sep 13 at 12:31










          • so can you please update the answer , instead the remark so I will choose the right answer
            – yael
            Sep 13 at 12:33















          but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
          – yael
          Sep 13 at 12:16





          but XXXX-XX-XX can be 1998-02-34 or 2013-01-56 , etc , so the option "-name "XXXX-XX-XX*" must to fit to any date
          – yael
          Sep 13 at 12:16













          @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
          – B.McCready
          Sep 13 at 12:20





          @yael, are you saying there might be files of varying age and datestamps, but you only want to delete the ones whose names begin with a datestamp in the form of YYYY-MM-DD? then just change the -name option argument to "[12][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]*" or similar.
          – B.McCready
          Sep 13 at 12:20













          yes thats I mean
          – yael
          Sep 13 at 12:30




          yes thats I mean
          – yael
          Sep 13 at 12:30












          @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
          – michael
          Sep 13 at 12:31




          @yael I think I get what you're saying; you want the filename to match a pattern? You can do that via ‘-name '????-??-??‘ or ‘-name "[0-9][0-9]0-9][0-9]-[0-9] (etc)‘ or also see the 'regex‘ option stackoverflow.com/questions/19111067/…
          – michael
          Sep 13 at 12:31












          so can you please update the answer , instead the remark so I will choose the right answer
          – yael
          Sep 13 at 12:33




          so can you please update the answer , instead the remark so I will choose the right answer
          – yael
          Sep 13 at 12:33


          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay