Skip to content

einsiedlerspiel/cleandir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Small program to sort files in a directory

Configuration

Configuration is done through a toml file at ~/.config/cleandir/config.toml. A default configuration can be created by running clean-dloads-dir -s.

# Top Level tables define directory rules.
[Downloads]

# The direcotry to sort through.
directory = "~/Downloads"

# Relative path to which all files in `directory` will be
# moved. It can include escape sequences that will be expanded
# following the rules of the C library procedure `strftime`.
target-prefix = "%Y-%m"

# Optional key to disable moving files not matching a group
# (default=true).
move-ungrouped = true

# Optional key, if true (default) removes duplicate files
# from `directory` and it's subdirectories before applying the
# group rules. This affects `target-prefix`.
remove-duplicates = true

# Any sub tables define rules for groups of files identified by
# their extension.
[Downloads.pdf]
enabled = true       # optional key to disable a rule temporarily
extension = "pdf"    # extension of files the rule applies to
target = "PDF"       # subdir of `target-prefix` to use as target

[Downloads.images]
enabled = true

# instead of a single `extension` an array of `extensions` can be
# given
extensions = ["jpeg", "jpg", "png"]
target = "images"

[Downloads.office]
enabled = true
extensions = [
           "odt", "doc", "docx",
           "odp", "ppt", "pptx",
           "ods", "xsl", "xslx"
           ]
target= "office"

Building and Installing

To build the program you'll need a working instalation of chicken scheme. You can build and install simply by running

make && make install

By default this will install the program in ~/.local/, to install somewhere else e.g. /usr/ set PREFIX accordingly.

This repository comes with a systemd unit and timer, which can be used to run the programm periodically. The default period is weekly. To activate run

systemctl --user enable cleandloads.timer

Contributing

While I do not guarantee any form of support for this program, you can reach me with patches, suggestions and questions via mail.

TODOs

  • more flexible group definitions
  • automatic renaming of files
  • Date expansion based on date-modified instead of local-time

About

Small program to sort files in a directory.

Resources

License

Stars

Watchers

Forks