Skip to content

Adamacy/FileSorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

FileSorter

Simple program for sorting files with some separators in file name.
Sorter is creating folder for files with same first part of name.
If name is diffrent and folder doesn't exist sorter will create dir and put file in there.

How to use

First of all we have to chose our folder with files to sort. You can do it in this line.

path_to_files = 'F:/Captures'

After doing this you must chose separator.

 separator = ' '

Separator is chosing us a folder name.
Separator always chooses the first split part of the name.
You can change it in this line by changing number in [].
Program will not work if you chose number higher than separators in file name + 1. See example

folders = element.split(separator)[0] #0 is first

Example

example;file;2022_01_12.docx
path_to_folder/example/example;file;2022_01_12.docx

Too high number in []

File name is example;file;2022_01_12.docx you can set maximum number in square bracket to 3.
Because there are 2 semicolons and you're adding 1 to it.
If number is too high error will raise.