organize your files with prefixes
Project description
Riordinato
Riordinato is a python library for organizing files with prefixes.
Installation
Use the package manager pip to install riordinato.
pip install riordinato
Usage
Riordinato is used to organize files by prefixes. For example, we want to move files that have the prefixes python and work.
/home/user/documents
├── pythonWork.py
├── python_examples.txt
├── family.jpg
├── dog.png
├── index.html
├── work_list.txt
├── any_work.docx
├── python_exercise.pdf
├── work_for_later.docx
│
├── python/
└── work/
First import riordinato
from riordinato import Riordinato
Define a directory where we have the files we want to move.
path = '/home/user/documents'
NOTE: You can also put a windows path.
Create the instance.
organize = Riordinato(path)
If you want to see the files that are in the path you can print the files attribute.
>>> print(organize.files)
['pythonWork.py', 'python_examples.txt', 'family.jpg', 'dog.png', 'index.html',
'work_list.txt', 'any_work.docx', 'work_for_later.docx', 'python_exercise.pdf']
Now you have to create a prefix. to do it is the same when you create a new item for a dictionary, the key is the prefix and the value is the destination
organize.prefixes['python'] = './python'
organize.prefixes['work'] = './work'
NOTE: Riordinato by default transforms all paths into an absolute path. This allows your program to run from any path.
To organize our files we use the movefiles method
organize.movefiles()
And our directory would look like this.
/home/user/documents
├── family.jpg
├── dog.png
├── index.html
├── any_work.docx
│
├── python/
│ ├── python_exercise.pdf
│ ├── pythonWork.py
│ └── python_examples.txt
└── work/
├── work_for_later.docx
└── work_list.txt
If we want to move files with a specific prefix, use the "specific" parameter of the method.
organize.movefiles(specific='python')
/home/user/documents
├── family.jpg
├── dog.png
├── index.html
├── work_list.txt
├── work_for_later.docx
├── any_work.docx
│
├── python/
│ ├── python_exercise.pdf
│ ├── pythonWork.py
│ └── python_examples.txt
└── work/
You can also ignore files that contain a certain prefix. In this case we will ignore the files that contain the python prefix.
organize.movefile(ignore='python')
/home/user/documents
├── pythonWork.py
├── python_examples.txt
├── family.jpg
├── dog.png
├── index.html
├── any_work.docx
├── python_exercise.pdf
│
├── python/
└── work/
├── work_for_later.docx
└── work_list.txt
NOTE: the specific and ignore parameters are also compatible with lists.
Contributing
A contributing.md will be added soon.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for riordinato-1.7.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fd4866f5764a794d0945cd02a7c0c317d99c46f1af3fe97afa9f972b6e906fd |
|
MD5 | a08ff1bb34e799422c095b20020c5a3e |
|
BLAKE2b-256 | b992ae9d7a7f4a5398025d393748f4c94b64055b599fb1e907a51cb89ba60501 |