Just a small set of python files to copy/move files into named subdirs released under the zlib/png license. I initially created this one solely because I needed to grab a bunch of NES roms for my Everdrive n8 and move them into subfolders 1-8 and A-Z.
dirpart is released under the zlib/png license. Basically, you can use this software in any way you see fit, including commercial applications. If you use it as part of something larger, a mention would be appreciated (but not necessary)
$ ls
a_file a_file_2 b_file x_file
$ dirpart . -o out/
$ ls out/
A B X
$ ls out/A
a_file a_file_2
... And so on
Try dirpart --help
to see all flags. These examples assume that
dirpart is symlinked as just 'dirpart'. Otherwise, use the full name
(dirpart.py) instead:
$ dirpart . -o out/ # Part files into subdirs in out/
# by copying the files
$ dirpart . -o out/ --move # Same deal, but moving the files
# instead of copying
$ dirpart . -o out/ --regexp='...' # Only apply to files matching
# the given regular expression
$ dirpart . -o out/ --max=254 # Max 254 files per directory
# Everything else goes into consecutive
# folders (such as A, A1, A2 etc.)
-
Clone/download/whatever and make sure Python 2.7 is installed
-
On Linux/UNIX, either use the command directly, or symlink:
$ ln -s /path/to/dirpart.py /usr/bin/dirpart
-
On Windows, either use the command directly, or make sure dirpart.py is in your path
To run the tests, from the root of the repository:
$ python -m t.test_dirpart
Pull requests are more than welcome. If you fix an issue or add a new feature, be sure to include a passing test case.