Skip to content

Python Script: File Sorter #86

@HemanthTenneti

Description

@HemanthTenneti

File Sorter

How It Works

  • It works with the simple principle of organizing files in a given folder with it's filetypes.
  • The fileExtensions.py consists a map with each file type to a certain folder name.
  • The main program looks for all singular scattered files in a given desktop location, ignoring all folders.
  • And it proceeds to create folders for each depending on the map of the file extensions.
  • Assuming the program has permission to move items in the given location, it will proceed to move the files to their designated folder.

Command Line Functionality

  • Added the functionality to call it through command-line
  • You can call it either through:
python "Path/To/PythonFile" "Path/To/Directory/To/Be/Sorted"
eg. python "C:/Users/test/FileSorter/fileSort.py" "C:/Users/test/Downloads"
  • Or alternatively, with a slight setup process, you can run "FileSort" in any powershell terminal and it'll sort the CWD.

Setup for FileSort PWSH Function

    1. Open Powershell, type the command notepad $PROFILE
    1. Add a function to the profile:
function fileSort {
    $cwd = Get-Location
    python "Path/To/PyFile" $cwd # Change Path/To/PyFile with location where the python file is saved.
}
    1. After the setup, you can open powershell in any folder and run the command "FileSort" with which, it's going to sort all the files in the working directory

Requirements

  • Python3: As this project was built entirely with Python, Python3 is required with the latest version being recommended.
  • The libraries used which need to be installed are tkinter and customtkinter, as these were used to make the user interface for the program.
  • You can install them by:
  • pip install tk
    pip install customtkinter
    

Metadata

Metadata

Labels

enhancementNew feature or requesthacktoberfestHacktoberfest 2023 contributionshacktoberfest-2024pythonpython-modulePython utility/resuable module, which can be imported in different scriptspython-scriptPython utility/automation script

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions