0% found this document useful (0 votes)
17 views3 pages

File Organization With Python

This report details the creation of a Python script designed to automate the organization of files in a directory by categorizing them based on their extensions. The project, part of an internship at CodeAlpha, aims to reduce manual effort and improve file management efficiency. The implementation successfully sorts files into designated folders, resulting in a more organized workspace.
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)
17 views3 pages

File Organization With Python

This report details the creation of a Python script designed to automate the organization of files in a directory by categorizing them based on their extensions. The project, part of an internship at CodeAlpha, aims to reduce manual effort and improve file management efficiency. The implementation successfully sorts files into designated folders, resulting in a more organized workspace.
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
You are on page 1/ 3

File Organization using Python Scripts

Task Automation Project Report

Amit Bikram Mishra


B.Tech Computer Science
Engineering
Ideal Institute of Engineering
June 6, 2025

Abstract
This report outlines the development of a Python-based script that automates the task of
organizing files within a directory. This project was undertaken as part of my internship
under the Python Programming domain at CodeAlpha. The solution helps in maintaining a
clean and structured file system by categorizing files into folders based on their extensions.

Introduction
In today’s digital age, managing large numbers of files can become chaotic and time-consuming.
Manually sorting files by type or category often leads to inefficiencies. This project auto-
mates the process of organizing files using a Python script, ensuring that files are arranged
into appropriate folders without manual intervention.

Objective
The main objectives of this project are:

• To reduce manual effort in organizing files.

• To build an efficient script that sorts files based on their extensions.

• To gain hands-on experience in task automation using Python.

Technology Used
• Language: Python 3

1
• Libraries: os, shutil

• Platform: Local development (VS Code / IntelliJ IDEA)

Implementation
The script works by scanning a specified directory, identifying the extension of each file, and
then moving the file into a corresponding folder. If the folder does not exist, it is created.

0.1 Code Snippet


Below is a simplified version of the script:
Listing 1: Python Script for File Organization
import os
import shutil

# Define source folder


source = " C :/ Users / YourUsername / Desktop / Files "

# List of file types and their categories


file_types = {
" Images " : [ " . jpg " , " . png " , " . jpeg " ] ,
" Documents " : [ " . pdf " , " . docx " , " . txt " ] ,
" Scripts " : [ " . py " , " . js " , " . cpp " ] ,
" Compressed " : [ " . zip " , " . rar " ] ,
}

# Organizing logic
for filename in os . listdir ( source ) :
filepath = os . path . join ( source , filename )
if os . path . isfile ( filepath ) :
ext = os . path . splitext ( filename ) [1]
for folder , extensions in file_types . items () :
if ext in extensions :
folder_path = os . path . join ( source , folder )
if not os . path . exists ( folder_path ) :
os . makedirs ( folder_path )
shutil . move ( filepath , os . path . join ( folder_path , filename ) )
break

Results
After running the script, all files in the selected directory were automatically moved into
their respective folders (Images, Documents, Scripts, etc.). This resulted in a cleaner and
more organized workspace.

2
Conclusion
The file organization script significantly improved productivity by automating a repetitive
task. This project enhanced my understanding of Python scripting and file handling, and
demonstrated the value of automation in daily computing tasks.

Acknowledgment
I would like to thank CodeAlpha for providing me the opportunity to work on such mean-
ingful projects and for guiding me throughout the internship.

References
• Python Official Documentation: https://docs.python.org/3/

• Stack Overflow: https://stackoverflow.com/

You might also like