├── Documentation ├── adress.jpg ├── adress_terminal.jpg ├── open_wth.jpg ├── organized.jpg └── whole_folder.jpg ├── README.md └── file_organizer.py /Documentation/adress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GautamPatil1/File_Organizer_Python/d21a789bf026fae9c3c382287e36672dd17ab4aa/Documentation/adress.jpg -------------------------------------------------------------------------------- /Documentation/adress_terminal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GautamPatil1/File_Organizer_Python/d21a789bf026fae9c3c382287e36672dd17ab4aa/Documentation/adress_terminal.jpg -------------------------------------------------------------------------------- /Documentation/open_wth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GautamPatil1/File_Organizer_Python/d21a789bf026fae9c3c382287e36672dd17ab4aa/Documentation/open_wth.jpg -------------------------------------------------------------------------------- /Documentation/organized.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GautamPatil1/File_Organizer_Python/d21a789bf026fae9c3c382287e36672dd17ab4aa/Documentation/organized.jpg -------------------------------------------------------------------------------- /Documentation/whole_folder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GautamPatil1/File_Organizer_Python/d21a789bf026fae9c3c382287e36672dd17ab4aa/Documentation/whole_folder.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # File Organizer Python 2 |

Python program to organize files based on their extensions.

3 | 4 |

---Prerequisite---

5 | You must install python on your PC to run this program. If you don't have python you can install it from here. 6 |

--Documentation--

7 | To use file_organizer program on your computer. 8 | 9 | Download the file_organizer.py file. 10 | 11 | 1.Open the folder where you want to organize your files. 12 | 13 | 14 |
15 |
16 | 2.Copy the directory adress path from that folder. 17 | 18 | 19 | 20 |
21 |
22 | 3.Run the program file_organizer.py, If you have an IDE installed open the file with default python. 23 | 24 | 25 |
26 |
27 | 5.Paste the adress copied from the folder when prompted in the terminal. 28 | 29 | 30 |
31 |
32 | 33 | 4.All the files in the folder will be organized according to their extensions. 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /file_organizer.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | import shutil 4 | import os.path 5 | 6 | 7 | 8 | def bytype(): 9 | path = input(" Enter the path of directory you want to organize: ") 10 | 11 | lis = os.listdir(path) 12 | lis.sort(key=lambda x: os.stat(os.path.join(path, x)).st_mtime) 13 | 14 | os.chdir(path) 15 | 16 | arr = os.listdir() 17 | 18 | slash = "\\" 19 | 20 | file_types = { 21 | 22 | "Text": [".doc", ".rtf", ".txt", ".wps", ".docx"], 23 | "Data": [".csv", ".pps", ".ppt", ".pptx", ".xml"], 24 | "Music": [".mp3", ".m4a", ".m4a", ".m4p", ".mp3", "ogg"], 25 | "Video": [".3gp", ".avi", ".flv", ".m4v", ".mov", ".mp4", ".wmv"], 26 | "notes": [".pdf"], 27 | "Spreadsheet": [".xlr", ".xls", ".xlsx"], 28 | "apps": [".apk", ".app", ".exe", ".jar"], 29 | "Web": [".css", ".htm", ".html", ".js", ".php", ".xhtml"], 30 | "Compressed": [".rar", ".zip"], 31 | "Programmes": [".c", ".class", ".cpp", ".cs", ".java", ".py"], 32 | "Misc": [".ics", ".msi", ".torrent"], 33 | "images": [".jpeg", ".png", ".jpg"] 34 | } 35 | 36 | for x in arr: 37 | fflag = 0 38 | if os.path.isfile(x): 39 | if "." in x: 40 | extension_name = x[x.index("."):] 41 | for file_type, extensions in file_types.items(): 42 | if extension_name in extensions: 43 | fflag = 1 44 | folder_name = file_type 45 | newpath = path + slash + folder_name 46 | print(newpath) 47 | break 48 | if fflag == 0: 49 | folder_name = "Other" 50 | newpath = path + slash + folder_name 51 | print(newpath) 52 | if not os.path.exists(newpath): 53 | os.makedirs(newpath) 54 | shutil.move(path + slash + x, newpath + slash + x) 55 | 56 | bytype() --------------------------------------------------------------------------------