Skip to main content

An Intelligent file organizer module that reads your file storing pattern

Project description

1 Filezen

version readthedocs.org codecov build pypi license deepsource

An Intelligent file organizer module which reads your file storing pattern & move the cluttered files accordingly!

Author:

Abhinav Anand

1.1 What is it

[back to top]

Let’s accept, no one likes to organize files on a regular basis. Even if you do, you wouldn’t want to do it everytime you download a new file.

Guess what! Filezen got you covered.

Given a folder of your cluttered/unorganized files, using Filezen, you can achieve the following

  • If you’ve never maintained specific directories for your files. Then Filezen's Basic Scanner can create suitable folders and organize your file into them.

  • If you already have a pattern of directories for storing different files. Then Filezen's Advanced Scanner can read your file storing pattern and move your files accordingly.

1.2 Features

[back to top]

  • Advanced Scanning

  • Basic Scanning

  • Minimum dependencies ( just uses Pathlib if only you’re working with Python 2.x )

  • Easy to use

  • Fast!

  • Returns JSON objects

  • Support
    • OS Support: Linux, Windows, Mac

    • Language Support: Python 2.x, 3.x

1.3 Installation

[back to top]

1.3.2 Option 2: Installing from source (Only if you must)

$ git clone https://github.com/ab-anand/Filezen.git
$ cd Filezen/
$ pip install -r requirements.txt
$ python setup.py install

Note: If you get permission denied then $ sudo python setup.py install should fix that

1.4 Usage

[back to top]

1.4.1 Simple Scanner

  • Simple Scanner uses a predefined mapping of filetypes to folder e.g. ".csv": "Documents".

  • Based on this mapping it creates directories(only if they don’t exist already) and organizes files into them as shown in the above Fig.

  • Using Simple Scanner

>>> from filezen import SimpleScanner as scanner
>>> input_directory = "/home/abhinav/Downloads"
>>> output_directory = "/home/abhinav/Documents"
>>> result = scanner.cleanDirectory(input_directory, outputPath=output_directory)
>>> print(result)
'{
    "Moved": [
        "FileA.pdf",
        "FileB.txt",
        "FileC.mp4",
        "FileD.log",
        "FileB.xyz"
    ],
    "NotMoved": [

    ]
}'
  • If no Output Directory is specified, then Simple Scanner would treat Input Directory as the Output Directory thus creating folders in the Input Directory itself.

1.4.2 Advanced Scanner

  • Advanced Scanner maintains a heap for each filetype/file-extension it encounters while scanning the Output Directory.

  • This heap contains all the directory addresses where a particular filetype(e.g. "pdf") occurs.

  • The address having the highest number of occurrence of that filetype is at the top of the heap

  • With the help of this heap it finally decides the directory where a particular filetype has mostly occurred and thus moving the all such files into that directory.

  • As shown in the above image, Advanced Scanner scans the child as well as sibling directories (at the same level).

  • The level of child directories to scan is decided by depth parameter as shown in the example below.

  • By default, depth = 5

  • Using Advanced Scanner

>>> from filezen import AdvancedScanner as scanner
>>> input_directory = "/home/abhinav/Downloads"
>>> output_directory = "/home/abhinav/Documents"
>>> depth = 3
>>> result = scanner.cleanDirectory(input_directory, outputPath=output_directory, depth=depth)
>>> print(result)
'{
    "Moved": [
        "FileA.pdf",
        "FileB.txt",
        "FileC.mp4",
        "FileD.log",
        "FileE.xyz"
    ],
    "NotMoved": [

    ]
}'
  • If no Output Directory is specified, then Advanced Scanner would read the folders in the Input Directory itself and move accordingly.

Note: If a file with the same name is already present in the Output Directory then Filezen would ignore the file and leave it to the user. In the resulting JSON, you’ll get the all such filenames which were not moved in the NotMoved list.

1.4.3 Applications

  • KRETA - It is a command line application which uses Filezen to organize file.

1.5 Documentation

[back to top]

For a detailed usage example, refer the documentation at Read the Docs

1.6 Contributing

[back to top]

Please refer Contributing page for details

1.7 Bugs

[back to top]

Please report the bugs at the issue tracker

1.8 License

[back to top]

Built with ♥ by Abhinav Anand under the MIT License ©

You can find a copy of the License at http://abhinav.mit-license.org/

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

Filezen-1.5.3.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

Filezen-1.5.3-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file Filezen-1.5.3.tar.gz.

File metadata

  • Download URL: Filezen-1.5.3.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for Filezen-1.5.3.tar.gz
Algorithm Hash digest
SHA256 e62b8d407f1c32f356ab3218c3369aa4b681351c69cf79855def5990ce8ee3b3
MD5 92c01e2377ca41956719ec8a3f9ae8c7
BLAKE2b-256 6c09a9f4b0993cefcdd5ca306fa38c3d19ae4e79c245d5cd63a4ae1b42a0d566

See more details on using hashes here.

File details

Details for the file Filezen-1.5.3-py3-none-any.whl.

File metadata

  • Download URL: Filezen-1.5.3-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for Filezen-1.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e512bb5bd15cd3a8900c99c70a86c4040d2cb79d39ad6322953de95473bce882
MD5 d255d6f976c5427ef0f43999048244c9
BLAKE2b-256 86e5a15107c388444ef0fcde12d6f57f2b12cc0f8e076061386eaf3816fab115

See more details on using hashes here.

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