Skip to main content

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 the files that have python in their name to the python folder and similar with the files that have 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'

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' 

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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

riordinato-1.4.0.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

riordinato-1.4.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page