/files_to_folders

Move files into folders based on their filename / filepath using regular expressions.

Primary LanguagePythonMIT LicenseMIT

Files to folders

PyPi travis documentation

Move files into folders based on their filename / filepath using regular expressions.

Features

  • Sort files into folders based on their filename / filepath using regular expressions
  • Can be used in the command line, e.g. in scripts or for piping

Installation

$ pip install git+https://github.com/d0m1987/files_to_folders.git

Examples

Assuming the following folder structure (that can be found in examples/first_simple_example)...

.
├── test_123.txt
└── test_124.txt

we run the following command in the folder with the structure above

$ files_to_folders --regexes "([a-z]*)_([0-9]*).txt" test_123.txt test_124.txt

This gives us the following folder structure:

.
├── files_to_folders.log
└── test
    ├── 123
    │   └── test_123.txt
    └── 124
        └── test_124.txt

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.