Coder Social home page Coder Social logo

tidyupper's Introduction

TidyUpper

This tool is menat to help organize directories. The development started due to the need of organizing messy directories by filetype.

This tool will create a certain structure based on what is configured in the config.json file. Including:

  • multiple directories for specified file extenions
  • a directory for unknown directories
  • a directory for every file extension that aren't specified in the config

Setup

Simply clone the repository. The default config.json shows an example configuration on which one can base their own.

The directory that shall be cleaned up needs to be configured under watch. You can use ~ to refer to your home dir.

To add a new directory with file extenions simply add a json object containing a pathkey with with the path relative to the specified watching directory and a filetypes array with the file extensions listed.

If you wish to automate this, i.e. with the Windows task scheduler, you can utilize the run.bat to run the script

Options

Subfolders for each filetype contained

The option sub_for_datatype expects a boolean value. If set to true the script will create in each folder-directory a directory for each filetype contained. These filetype-directories will contain symbolic/soft links to each file in the folder-directory with the given filetype.

Execution on Windows

If the sub_for_datatype option is set to true then on Windows enviorments the script must be executed from a command line where the executing user has the right to create symbolic links. By default users do not have this option. The easists solution is to run the run.bat as administrator or to execute the script from a command line thats started as administrator. Command Line programs that grant you administrator permissions such as gsudo can be handy here.

Tests

To test the application tox with pytest is used. When testing the sub_for_datatype option on windows tox must be started with administrator permissions.

tidyupper's People

Contributors

mbl-matthews avatar

Stargazers

 avatar

Watchers

 avatar

tidyupper's Issues

Sub-Directories with symbolic links for each filetype

Create a subfolder in each folder for each filetype present in the parent directory. Those subfolders shall contain symbolic link to the actual files in the main parent directory. The idea is to have an extra sorting mechanism based on filetypes.
Also make this an option inside the settings.ini

IDEA: Setup? GUI?

Maybe there is some kind of API or Toolset which allows to take the main script and turn it into some kind of service that runs in specified intervals?
Maybe just wrap the script in a fancy GUI where the script to organize the directory is fired of when wished together with some more options like multiple directories, filestypes and such?

Create options to disable default folders

Create options to disable default Extra and Leftover folders.

  • Unconfigured filetypes remain in watched directory if Leftover is disabled
  • Previously existing folders reamin in watched directory if Extra is disabled

TODO:

  • Create option in options object in config.json
  • Create optional condition checking disable options

Delete old softlinks

Make sure that old softlinks within the target directories are emptied once the script is run again

Setup CI/CD

Setup a CI Pipeline with Github Actions to run tox on push

Proper Error handling

TODO:

  • Edit existing try-catch clauses to have proper error handling
    • no simple error: - always catch a specific error
  • Add proper error handling where not existent yet

Create Unit Test

TODO:

  • setup tox enviorment
  • Create Unit test for exisiting functions and main script

Refactor symlink to be contained in its own script

The logic which creates a symbolic link for each file for each filetype in a directory shall be it's own individual script which can be run individually

TODO:

  • export logic to create symlinks into it's own SymbolicLinker.py script
  • add logic to the linker so it's able to be run individually

"Archive" script

The idea is that the archiver script only lets file of a certain age be remain in the main watched directory and every other file shall be moved to an archive directory in which all older files will go. For example: The Downloads folder shall only have files that are at maximum 7 days old. Older files shall be moved to a directory on a diffrent drive to keep the system partition clean.

TODO:

  • Create "archive" script
    • an archive is not a compressed file but a seperate directory in which file that are older than a certain time are moved to
  • add option to run archiver at end of TidyUpper.py script
  • add section to settings file for archiver
  • Archiver.py and TidyUpper.py shall be two different scripts that are able to be run individually
    • Archiver needs to be runnable from TidyUpper.py

Folder and Filetypes from Settings file

TODO:

  • Pull information for how to name folders and what filetypes shall go in there from settings.ini
  • create dictionary from those the by the following scheme
    • [section]
    • keyname=json with name and comma seperated filetypes
  • example
    • [folder]
    • imgs={"path":"Images", filetype:"png,jpg,jpeg,gif"}

Notice:

  • Unzipped and Leftovers shall not be affected by this yet

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.