Skip to content

This script can clean any folders and sorts all files in the folder according to file's extensions.

Notifications You must be signed in to change notification settings

OleksandrGnatiuk/clean_folder_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HitCount

Clean-folder script package

This script can sort all files in folder. It sorts all files according to file's extensions.
Files with Cyrillic name will be renamed to Latin name.
All files will be replaced to folders: "document", "music", "video", "images", "archives", "other", etc. You can change the list of these folders and set your own rules of sorting files.

Installation

Download package, unpack it and use next command to install it from unpacked folder:

pip install -e .

How to use clean-folder script?

You have to run from the command line:

clean-folder <path to folder you want to clean>
  • if this folder is not exists, you'll see a message in console.

  • The script sorts files according to file's extensions.

  • Default folders are documents, images, video, audio and archives.

  • if you want to set your own rules of sorting files you have to change extension_dict:

    extension_dict = {
      "documents": [".doc", ".docx", ".xls", ".xlsx", ".txt", ".pdf"],
      "audio": [".mp3", ".ogg", ".wav", ".amr"],
      "video": [".avi", ".mp4", ".mov", ".mkv"],
      "images": [".jpeg", ".png", ".jpg", ".svg"],
      "archives": [".zip", ".gz", ".tar"],
      }
  • All files with relevant extensions will be moved to these folders;

  • Other files will be replaced to folder other;

  • if these folders were not exist its will be created;

  • The script recursively checks all subfolders and replaces all files to destination folders;

  • Empty folders will be deleted;

  • Files with Cyrillic name will be renamed to Latin name;

  • if subfolders involve the files with the same name, these files will be renamed - date-time will be added to file's name;

  • All archives will be unpacked to subfolder with the name as archive's name in folder archive;

  • if archive is broken, script will continue its work without unpacking this archive. In console you'll see message about this broken archive;

  • When script finishes to clean folder, you'll see the report.

If any questions, please contact to oleksandr.gnatiuk@gmail.com

About

This script can clean any folders and sorts all files in the folder according to file's extensions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages