GithubHelp home page GithubHelp logo

anurag1504t / filezen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ab-anand/filezen

0.0 0.0 0.0 56 KB

An Intelligent file organizer module that reads your pattern 📂

Home Page: https://filezen.readthedocs.io/en/latest/

License: MIT License

Python 100.00%

filezen's Introduction

1   Filezen

pypi readthedocs.org license build

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.1   Option 1: installing through pip (Recommended)

pypi package link

$ pip install Filezen

If you are behind a proxy

$ pip --proxy [username:password@]domain_name:port install -i https://pypi.org/project/Filezen/

Note: If you get command not found then $ sudo apt-get install python-pip should fix that

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

1.4   Usage

[back to top]

1.4.1   Simple Scanner

  • Simple Scanner uses a predefined mapping of filetypes to folder.
  • Based on this mapping it creates directories and organizes files into them as shown in the above Fig.
  • Using Simple Scanner
>>> from filezen.simpleScanner import simplescanner as SSC
>>> scanner = SSC.SimpleScanner()
>>> 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 a file with the same name is already present in the Output Directory then Simple Scanner would ignore the file and leave it to the user.
  • The filename which hasn't being because of the reason stated above would be returned in the NotMoved array of the result.
  • If no Output Directory is specified, then Simple Scanner would create 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.
  • 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 directories also.
  • 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.advancedScanner import advancedscanner as ASC
>>> scanner = ASC.AdvancedScanner()
>>> 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": [

    ]
}'
  • Similar to Simple Scanner, if a file with the same name is already present in the Output Directory then Advanced Scanner would ignore the file and leave it to the user.
  • The filename which hasn't being because of the reason stated above would be returned in the NotMoved array of the result.
  • If no Output Directory is specified, then Advanced Scanner would read the folders in the Input Directory itself and move accordingly.

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 ©

filezen's People

Contributors

ab-anand avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.