Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

boneskull/declutter

Repository files navigation

declutter Build Status

Automatically sort files into directories

Probably not usable until v0.1.0.

Synopsis

Categorizes files by type (archive, image, audio, document, etc.) and moves them into destination directories.

Globs supported. Theoretically, you can configure it to move files outside of the directory, and not just into subdirs.

I wrote this because I have way too much crap in my Downloads folder.

Install

$ npm install -g declutter

Usage

declutter [options] <directory> [...directory]

Options:
  --dry-run   Don't actually do anything              [boolean] [default: false]
  --verbose   More output                             [boolean] [default: false]
  --debug     Even more output                        [boolean] [default: false]
  --version   Show version number                                      [boolean]
  --help, -h  Show help                                                [boolean]

Config File Syntax

To configure declutter, you want to create a .declutter file in the directory you want decluttered. This is a YAML file, FWIW.

The pattern is this; one on each line:

glob: destination

Example:

'*.torrent': torrent
'*.coffee': ~/.Trash

This will move all BitTorrent (*.torrent) into the torrent/ subdir, and all CoffeeScript (*.coffee) files into the Trash (OS X). 😉

Any globs here will override the default settings, which are pulled from a swath of foo-extension modules on npm.

Defaults

Extensions are sorted into categories; each category corresponds to a subdirectory.

  • 3D graphics: 3d/
  • Documents: document/
  • Archives, installers, disk images: archive/
  • Images: image/
  • Audio: audio/
  • Text: text/
  • Apps: application/
  • Fonts: font/
  • Video: video/
  • Subtitles: subs/

TODO: Compile a list of source code file extensions; publish this as a module & use it to create a "code" category.

API

declutter exports a single function which accepts two parameters; the first is the directory to operate on, and the second is an options object corresponding to the CLI's flags.

Development

  1. git clone this repo.
  2. Navigate to working copy and execute npm install.
  3. Execute npm run build, which runs the source through babel.
  4. (Optional) execute npm link.

Notes

This would be useful when paired with fswatch, Gaze, etc. Perhaps OS X folder actions and automator. Then it would immediately move whatever you just downloaded into the configured directory.

License

© 2015 Christopher Hiller. Licensed MIT.

About

Automatically sort files into directories

Resources

License

Stars

Watchers

Forks

Packages