0% found this document useful (0 votes)
8 views1 page

File Organizer Script in Python

This document contains a Python automation script designed to organize files in a specified folder by their file extensions. It creates subfolders for each file extension and moves the corresponding files into these subfolders. The script prompts the user to enter the folder path to be organized.

Uploaded by

yusufarpan7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

File Organizer Script in Python

This document contains a Python automation script designed to organize files in a specified folder by their file extensions. It creates subfolders for each file extension and moves the corresponding files into these subfolders. The script prompts the user to enter the folder path to be organized.

Uploaded by

yusufarpan7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Automation Python Script

# Python Automation Script: File Organizer by Extension


import os
import shutil
def organize_files_by_extension(folder_path):
for filename in [Link](folder_path):
file_path = [Link](folder_path, filename)
if [Link](file_path):
ext = [Link]('.')[-1]
ext_folder = [Link](folder_path, ext)
[Link](ext_folder, exist_ok=True)
[Link](file_path, [Link](ext_folder, filename))
if __name__ == "__main__":
path = input("Enter folder path to organize: ")
organize_files_by_extension(path)

You might also like