Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattbostock/rotate
A small command-line utility to rotate files or directories
https://github.com/mattbostock/rotate
backup rotation schedule
Last synced: about 5 hours ago
JSON representation
A small command-line utility to rotate files or directories
- Host: GitHub
- URL: https://github.com/mattbostock/rotate
- Owner: mattbostock
- License: mit
- Created: 2015-03-28T20:58:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-06T11:07:18.000Z (about 9 years ago)
- Last Synced: 2024-06-19T05:51:41.300Z (5 months ago)
- Topics: backup, rotation, schedule
- Language: Go
- Homepage:
- Size: 218 KB
- Stars: 20
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Report Card](http://goreportcard.com/badge/mattbostock/rotate)](http://goreportcard.com/report/mattbostock/rotate)
[![Build Status](https://travis-ci.org/mattbostock/rotate.svg?branch=master)](https://travis-ci.org/mattbostock/rotate)# 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
-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
```