rotate

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2015 License: MIT Imports: 11 Imported by: 0

README

Go Report Card Build Status

rotate

A small command-line utility to rotate a file or directory.

Follows a specified schedule passed as a commandline argument and purges old rotations.

Rationale

I've seen a number scripts written to perform backups implement file rotation in diverse ways, often without tests to verify their behaviour.

To avoid reinventing the wheel each time, it occurred to me that it would be useful to have a utility that does the one job of rotating a file or directory. I couldn't find any existing utility that compiles to a binary to fulfill that task, so I wrote this one.

Usage

./rotate -help
Usage: ./rotate <source> <target>
  -schedule="1d:7,1w:5,1m:12,1y:4": rotation schedule and retention period
  -verbose=false: verbose output
  -version=false: prints current version

Example using default schedule

This example shows the first rotation of a directory named source using the default schedule and retention policy.

$ tree source
source
├── fileA
├── fileB
├── dirA
└── dirB
$ rotate source target
$ tree target
target
├── 1d
│   └── 2015-08-15
│       ├── fileA
│       ├── fileB
│       ├── dirA
│       └── dirB
├── 1m
│   └── 2015-08-15
│       ├── fileA
│       ├── fileB
│       ├── dirA
│       └── dirB
├── 1w
│   └── 2015-08-15
│       ├── fileA
│       ├── fileB
│       ├── dirA
│       └── dirB
└── 1y
    └── 2015-08-15
        ├── fileA
        ├── fileB
        ├── dirA
        └── dirB

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/stretchr/testify/assert
A set of comprehensive testing tools for use with the normal Go testing system.
A set of comprehensive testing tools for use with the normal Go testing system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL