Coder Social home page Coder Social logo

ilyaevseev / ls4sweep-perl Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 3 KB

ls4sweep is a tool intended for use as helper for removing old backups. A sweeping policy consists of a set of records that contains the number of intervals or a periods in days to retain. It checks creation or modification time of given files and displays names of those when they don't match the policy. The output can than be passed to rm. Previous version was written on pure C, current is quickly rewritten on Perl.

Perl 86.11% Shell 13.89%

ls4sweep-perl's Introduction

ls4sweep readme

  • ls4sweep is a tool intended for use as helper for removing old backups.
  • A sweeping policy consists of a set of records that contains the number of intervals or a periods in days to retain.
  • It checks creation or modification time of given files and displays names of those when they don't match the policy.
  • The output can then be passed to rm.

Example

ls4sweep 3:1,2:3,2:10,2:30,3:90,5:365 *.zip

This means:

  • keep daily ZIP-archives in current directory for last 3 days
  • older than 3 days: keep 2 archives with 3-days delta
  • older than 9 days ((3 * 1) + (2 * 3)): keep 2 archives with 10-days delta
  • older than one month ((3 * 1) + (2 * 3) + (2 * 10)): keep 2 archives with monthly delta
  • older than 3 months: keep 3 archives with 90-days delta
  • older than one year: keep yearly archive for five years
  • display filenames of all remaining stuff

ls4sweep output can be directly passed to the input of '| xargs -r /bin/rm -f' command:

ls4sweep 3:1,2:3,2:10,2:30,3:90,5:365 *.zip 2>sweep_errors.log | xargs -r /bin/rm -f 2>remove_errors.log

Requirements

  • Perl ;)

ls4sweep-perl's People

Contributors

ilyaevseev avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.