Removing outdated files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jan Danielsson

    #1

    Removing outdated files

    Hello all,

    I have a backup system which produces files using the following pattern:

    <basename>.<dat e>.<extension>

    For instance:

    documents.2007-01-01.tar.bz2.gpg
    documents.2007-01-02.tar.bz2.gpg
  • Gabriel Genellina

    #2
    Re: Removing outdated files

    At Tuesday 23/1/2007 02:17, Jan Danielsson wrote:
    I've been looking at the datetime.date class, but I can't see any
    >easy way to parse the week number from it. I could calculate this
    >information by brute force -- but I get a feeling that there are
    >functions in Python to extract week numbers from a date.
    ..isocalendar()


    --
    Gabriel Genellina
    Softlab SRL






    _______________ _______________ _______________ _____
    Preguntá. Respondé. Descubrí.
    Todo lo que querías saber, y lo que ni imaginabas,
    está en Yahoo! Respuestas (Beta).
    ¡Probalo ya!


    Comment

    • Jan Danielsson

      #3
      Re: Removing outdated files

      Gabriel Genellina wrote:
      > I've been looking at the datetime.date class, but I can't see any
      >easy way to parse the week number from it. I could calculate this
      >information by brute force -- but I get a feeling that there are
      >functions in Python to extract week numbers from a date.
      >
      .isocalendar()
      .thanks()

      --
      Kind regards,
      Jan Danielsson

      Comment

      • Laurent Pointal

        #4
        Re: Removing outdated files

        Jan Danielsson a écrit :
        Hello all,
        >
        I have a backup system which produces files using the following pattern:
        ....
        >
        Obviously, I have little need for *all* those files. What I want to
        do is to delete old files according to this pattern:
        >
        - Keep all backup files which are two weeks, or less, old
        - If backups are more than two weeks old, then keep only the latest
        one for each week.
        - If backups are more than two months old, then keep only the latest
        one for each month.
        - If backups are more than two years old, then keep only the latest
        one for each year.
        You should take a look at snapy, AFAIR it does things like this to
        manage snapshot backups (with cp [+rsync] [+ssh]).



        Comment

        Working...