GithubHelp home page GithubHelp logo

dirclean's Introduction

Dirclean

A simple tool to organize your directories based on predicates.

Configuration

The configuration for dirclean uses ini files.

Sections denote a directory, and within that patterns, actions, and watching behaviours tell dirclean how to function with that directory.

For instance:

[~/Downloads] # Section denotes this acts on all files in directory ~/Downloads
pattern = `*\.zip` # only select files matching pattern, see selectors supported
move_to = "zip" # Move to new folder, see actions supported
watch = true # watch files in directory (via inotify).

[~/Downloads] # Can have the same directory multiple times
pattern = >2d
delete = true
watch = false
poll = 60m # scan directory hourly

Actions

ActionDescription
move_toMove files to directory (create if needed), with pattern matching support
deleteDelete files
execRun command with file passed as argument

Pattern matching

Pattern matching allows the use of regex to intelligently rename files. It utilizes regex capture groups to achieve this.

For instance you could use (.+)\.zip, which would capture the filename of only zip files. You could then use the move_to action to move this file to another folder of the same filename like zip/{}/. So for instance hello.zip would be placed at zip/hello/hello.zip.

# Example of pattern matching
[~/Downloads]
# Match mp3 files that follow the regex "{artist} - {title}.mp3"
pattern = `(.+) - (.+)\.mp3$`
move_to = "~/Music/{}/{}/"
watch = true

Selector

SelectorDescription
patternMatch files based on regex
ageMatch files based on age

Usage

Simply run dirclean to start the daemon, it’ll silently work in the background to clean the directories as specified by your configuration.

dirclean's People

Contributors

lispandfound avatar

Watchers

 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.