You are on page 1of 51

PROFORMA FOR THE APPROVAL PROJECT PROPOSAL

PNR No.: Roll No:

1. Name of the Student

2. Title of the Project

3. Name of the Guide

4. Teaching experience of the Guide

5. Is this your first Submission? Yes No

Signature of the Student Signature of the Guide

Date: Date:

Signature of the
Coordinator Date:

I
PYTHON FILE MANAGEMENT SYSTEM

II
ABSTRACT

Python File management system is a project which aims in developing a computerized


system.This project has many features which are generally not availiable in normal File management
systems like facility of user login and a facility of teachers login .It also has a facility of admin
login through which the admin can monitor the whole system. It has also a facility where student after
logging in their accounts. The admin after logging into his account ie admin account can generate
various reports.

Overall, this project of ours is being developed to help the students as well as staff to maintain files in
the best way possible and also reduce the human efforts.

III
ACKNOWLEDGMENT

My thesis, with its complexities and difficulties, was not an easy task. After completing the task of its
production, I take this occasion to thank God, almighty for blessing us with his grace and taking
our endeavor to a successful culmination.

My thesis supervisor, was also very supportive of everything. He gives me tremendous support and
help throughout, even though it took up a lot of his precious time.
I wish to acknowledge all my university teachers who support and guide me throughout this degree. I
am also thankful to my family who support me in my studies.

IV
TABLE OF CONTENTS

CHAPTER 1 INTRODUCTION
1.1 MOTIVATION.....................................................................................................................
1.2 SCOPE................................................................................................................................
1.3 SOFTWARE TOOLS.............................................................................................................
1.4 OBJECTIVES.......................................................................................................................

CHAPTER 2: LITERATURE REVIEW

CHAPTER 3: METHODOLGY
3.1 PROJECT CONSTRAINTS.....................................................................................................
3.2 BRIEF OUTLINE OF THE IMPLEMENTED SYSTEM...............................................................
3.3 Coding of the Project ........................................................................................................

CHAPTER 4: FEATURE EXTRACTIONS


4.1 USER INTERFACE (GUI)......................................................................................................
4.1.1 UI DESIGN...................................................................................................................

CHAPTER 5: RESULTS AND DISCUSSION


5.1 EXPERIMENT AND ANALYSIS.............................................................................................
5.2 FAILURE ANALYSIS.............................................................................................................

CHAPTER 6: CONCLUSION AND FUTURE WORK


6.1 CONCLUSION.....................................................................................................................
6.2 FUTURE WORK..................................................................................................................

REFERENCES.................................................................................................................
CHAPTER 1

INTRODUCTION

A file manager or file browser is a computer program that provides a user interface to work with
file systems. The most common operations used are create, open, edit, view, print, play, rename,
move, copy, delete, attributes, properties, search/find, and permissions. Files are typically displayed
in a hierarchy. Some file managers contain features inspired by web browsers, including forward
and back navigational buttons. Some file managers provide network connectivity. In Windows the
program that does this is called Windows Explorer.

A file management system is a software solution or framework designed to organize, store, and
retrieve files efficiently. It provides a structured approach to file organization, enabling users to
easily locate, access, and manipulate their files with speed and accuracy. Whether it's a small
personal collection of documents or a vast corporate database, a well-designed file management
system simplifies the entire process, leading to increased productivity, improved collaboration, and
enhanced data security.

At its core, a file management system offers several key benefits. Firstly, it brings order to the
chaos of file storage. By providing a structured framework, users can organize files into logical
folders, apply tags or labels, and utilize metadata, making it easier to navigate and find specific
files when needed. This eliminates the frustration and time wasted in searching through countless
directories or relying on inefficient naming conventions.

Thought file management was just for paper files? Think again. It’s just as important to keep the
files on your computer organized and up-to-date. Just as with paper files, the goal of computer file
management is to ensure that you can find what you’re looking for, even if you’re looking for it
years after its creation. These file management tips will help you keep your files accessible:

Some benefits:

One place for all.

Create folders in My Documents.

Back up your files regularly.

Cull your files regularly.


1.1 MOTIVATION

In today's digital age, information is the backbone of any successful organization. The volume of
digital files and documents generated on a daily basis can be overwhelming, leading to disarray,
inefficiency, and wasted time. That's where a state-of-the-art File Management System comes into
play, offering a comprehensive solution to streamline and optimize file organization, storage, and
retrieval processes. By addressing the challenges of information management head-on, such a
system has the power to revolutionize productivity, collaboration, and overall success for
individuals and businesses alike.

Efficient file management is key to productivity. Locating the right document swiftly and
effortlessly saves valuable time and allows employees to focus on tasks that truly matter. A File
Management System provides a centralized hub where users can store, categorize, and retrieve
files, enabling streamlined access and boosting productivity across the board. By eliminating the
frustration of manual searches and ensuring quick file retrieval, teams can work more effectively,
complete projects on time, and achieve their goals with greater efficiency

1.2 SCOPE

The scope of file management systems encompasses a wide range of functionalities and
features designed to effectively handle and organize files.

File Organization: File management systems provide a structured framework for


organizing files, folders, and directories. This includes options for creating, renaming,
moving, and deleting files or folders, as well as the ability to arrange files based on
categories, tags, or metadata.

File Retrieval and Search: An essential feature of file management systems is the ability
to search for and retrieve specific files quickly. This is achieved through advanced search
capabilities that allow users to search by file name, file type, date, keyword, or other
relevant criteria.

File Sharing and Collaboration: File management systems facilitate seamless file sharing
and collaboration among users or teams. They often include features such as file sharing
links, access controls, version control, and real-time collaboration options to enhance
teamwork and productivity.
Security and Access Control: File management systems prioritize data security by
implementing robust access controls and encryption measures. These systems allow
administrators to define user permissions, restrict access to sensitive files, and monitor user
activities to prevent unauthorized access or data breaches.

Backup and Recovery: Reliable file management systems offer mechanisms for backing
up files and ensuring data integrity. They may include automated backup options, version
history tracking, and disaster recovery capabilities to protect against data loss or system
failures.

1.3 SOFTWARE TOOLS

Due to the time constraint and complexity of implementing system in C++, the aim was to
design a prototype under Python that was optimized for detection performance. A system
that accepted varying inputs of different sizes was implemented; constructing a well coded
and documented system for easier future development.

1.4 OBJECTIVES

First objective of this project is to create a complete system to upload, download and
manage different types of files

Second objective of the project is therefore to provide a new low-cost, high speed and
reliable file management system.
CHAPTER 2

LITERATURE REVIEW
A file management system is a type of software that manages data files in a computer
system. It has limited capabilities and is designed to manage individual or group files, such
as special office documents and records. It may display report details like owner, creation
date, state of completion and similar features useful in an office environment.

The data that we work with on computers is kept in a hierarchical file system in which
directories have files and sub-directories beneath them. Although we use the computer
operating system to keep our image data organized, how we name files and folders, how
we arrange these nested folders, and how we handle the files in these folders are the
fundamental aspects of file management.

The operating system’s organization of our data can be enhanced by the use of cataloging
programs, which make organizing and finding image files easier than simply relying on the
computer’s directory structure.

File Management is very important, because if they are not stored in an ordered,
methodical way you may never be able to find them again. Secondly, files need to be
backed up. USB’s, CD’s and even hard drives can become corrupted.

File management systems play a crucial role in organizing, storing, and retrieving files
efficiently. While the literature on this topic is vast and continuously evolving, here are
some key points that are often discussed:

Functionality and Features: Researchers have explored various functionalities and


features of file management systems. These include file organization, search capabilities,
version control, file sharing and collaboration, data security, and backup and recovery
mechanisms.

Performance and Scalability: The literature highlights the importance of file management
systems that can handle large volumes of files and user interactions without compromising
performance. Scalability is a crucial consideration to ensure the system can accommodate
increasing file sizes and user demands.

User Interface and User Experience: Researchers have focused on improving the user
interface and overall user experience of file management systems. Studies have explored
intuitive navigation, customizable interfaces, and visual representations to enhance
usability and user satisfaction.

Integration and Interoperability: The ability of file management systems to integrate


with other software applications and systems is often emphasized. Researchers have
explored ways to enhance interoperability, allowing seamless file exchange and
synchronization across different platforms.
Security and Privacy: Ensuring the security and privacy of files is a significant concern in
file management systems. The literature discusses encryption techniques, access control
mechanisms, and data protection measures to safeguard files from unauthorized access or
breaches.

Collaboration and Workflow Optimization: Researchers have investigated collaborative


features that enable users to work on files simultaneously, track changes, and streamline
workflows. Integration with project management tools and communication platforms has
been explored to enhance collaboration among teams.

Compliance and Governance: File management systems must comply with regulatory
requirements and industry standards. Researchers have examined features such as data
retention policies, audit trails, and compliance reporting to ensure adherence to legal and
regulatory frameworks.
CHAPTER 3

METHODOLGY
INTRODUCTION
There have been numerous researches in this field and several methodologies were
proposed I have also studied different approaches to management systems and came to
know that implementation of some techniques like a proper database or server is
complicated, we can produce same output as these techniques gives us by simple and easy
implementation.
Here's a speculative overview of the methodology typically employed in the development
of file management systems:
Requirements Gathering: The development process begins with gathering requirements
from stakeholders, including end-users, administrators, and system operators. This involves
understanding the specific needs and objectives of the file management system, such as file
organization, search capabilities, security requirements, and integration with other systems.

System Design: Once the requirements are collected, the next step is to design the file
management system. This includes defining the overall system architecture, data structures,
and interfaces. The design phase also involves planning for key functionalities such as file
organization schemes, user interfaces, access controls, and collaboration features.

Implementation: Based on the system design, the file management system is implemented
using appropriate programming languages and technologies. Developers write the code for
various components, including file manipulation operations, search algorithms, user
interfaces, and security mechanisms. The implementation phase also involves rigorous
testing to ensure that the system functions as intended and handles various scenarios
effectively.

User Interface Design: A crucial aspect of file management systems is the user interface.
User interface designers collaborate with developers to create intuitive and user-friendly
interfaces. This involves considering factors such as ease of use, visual design, navigation,
and responsiveness.

Integration and Testing: File management systems often need to integrate with other
software applications or systems. During this phase, integration points are identified, and
interfaces are developed to enable seamless communication and data exchange. Rigorous
testing is conducted to ensure compatibility, functionality, and performance.
Deployment and Maintenance: Once the file management system has been developed and
thoroughly tested, it is deployed in the production environment. System administrators
manage the installation, configuration, and ongoing maintenance of the system. Regular
updates, bug fixes, and performance optimizations are performed to ensure the system's
reliability and efficiency.

User Training and Support: It is essential to provide training and support to end-users,
administrators, and other stakeholders to effectively utilize and manage the file
management system. This includes providing documentation, conducting training sessions,
and offering support channels for addressing user inquiries and issues.

Continuous Improvement: File management systems are continuously improved based on


user feedback, technological advancements, and changing requirements. Regular
assessments and evaluations are conducted to identify areas for enhancement and to
implement updates or new features as needed.
.

3.1 PROJECT CONSTRAINTS

I propose an approach to accomplish the task of creating a file management system. To


reduce the variability in hand recognition task we assume the following assumptions:

1. The file is not malicious


2. The file is not corrupt

The Python File Management System depends on the hardware and software.

Hardware
 Minimum 2.8 GHz processor Computer System or latest
 A stable internet connection
Software
 Windows 7, 8, 10 or 11
 Python 3.8 or latest

3.2 BRIEF OUTLINE OF THE IMPLEMENTED SYSTEM

Here's a brief outline of a Python file management system:

User Input:

Prompt the user for the desired action (e.g., create a file, delete a file,
rename a file, list files in a directory).

Obtain any necessary additional input from the user, such as file names or
directory paths.

Create a File:

Accept a file name from the user.

Use the open() function to create a new file with the given name.
Handle any potential exceptions that may occur during file creation.

Delete a File:

Accept a file name from the user.

Use the os.remove() function to delete the specified file.


Handle any exceptions that may arise during file deletion.

Rename a File:

Accept the current file name and the desired new name from the user.

Use the os.rename() function to rename the file.

Handle exceptions, such as if the file does not exist or the new name
conflicts with an existing file.
List Files in a Directory:
Accept a directory path from the user.

Use the os.listdir() function to retrieve a list of files and directories within
the specified directory.

Iterate through the list and display the file names.

Error Handling:

Implement error handling mechanisms to handle scenarios like invalid


input, file not found, or permission issues.

Display informative error messages to the user when errors occur.

User Interface:

Create a user-friendly interface to interact with the file management


system.

Display clear instructions and options for the user.


Provide feedback on the success or failure of each operation.
3.31 Coding of the Project

One should understand how the program was written so that it becomes easier to
identify various features which are explained in the next chapter.

from app import create_app


from os import path

if __name__ == "__main__":
app = create_app()

# Check if db.sqlite file exists or not. If not then create db.sqlite


if not path.exists("app/db.sqlite"):
print ("<------------>")
print("Setting up Database ..")
print ("<------------>")
print()
with app.app_context():
from app import db
db.create_all()
print ("<------------>")
print("Database Setup Completed ..")
print ("<------------>")
print()

app.run(host ='127.0.0.1', port = 8080, debug = True)


App.py

from flask import Blueprint, request, render_template, redirect, url_for,


flash
from werkzeug.security import generate_password_hash,
check_password_hash
from . import db
from flask_login import login_user, logout_user, login_required
from .models import Users

auth = Blueprint('auth', __name__)

@auth.route('/login')
def login():
return render_template('login.html')

@auth.route('/login', methods=['POST'])
def login_post():
username = request.form.get('username')
password = request.form.get('password')
remember = True if request.form.get('remember') else False

user = Users.query.filter_by(username=username).first()

# check if user actually exists


# take the user supplied password, hash it, and compare it to the
hashed password in database
if not user or not check_password_hash(user.password, password):
# if user doesn't exist or password is wrong, reload the page
flash('Please check your login details and try again.')
return redirect(url_for('auth.login'))

# if the above check passes, then we know the user has the right
credentials
login_user(user, remember=remember)
return redirect(url_for('main.home'))

@auth.route('/register')
def register():
return render_template('register.html')
@auth.route('/register', methods=['POST'])
def register_post():
email = request.form.get('email')
username = request.form.get('username')
password = request.form.get('password')

# if this returns a user, then the username already exists in database


user = Users.query.filter_by(username=username).first()

# if a user is found, we want to redirect back to register page so user


can try again
if user:
flash('Email address already exists')
return redirect(url_for('auth.register'))

# create new user with the form data. Hash the password so plaintext
version isn't saved.
new_user = Users(email=email, username=username,
password=generate_password_hash(password, method='sha256'))

# add the new user to the database


db.session.add(new_user)
db.session.commit()

return redirect(url_for('auth.login'))

@auth.route('/logout')
@login_required
def logout():
logout_user()
return render_template('index.html')
MAIN.py

from flask import Blueprint, request, render_template, redirect, url_for, flash, send_from_directory,
send_file
from . import db
from flask_login import login_required, current_user
from .models import OriginalFiles, MappedFiles, Users
from werkzeug.utils import secure_filename
import os
import hashlib

main = Blueprint('main', __name__)

@main.route('/')
def index():
return render_template('index.html')

@main.route('/home')
@login_required
def home():
return render_template('profile.html', username=current_user.username)

@main.route('/upload')
@login_required
def upload():
return render_template('upload.html', username=current_user.username)

def allowed_file(filename):
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS

@main.route('/upload', methods=['POST'])
@login_required
def upload_post():
file = request.files['file']

# get filename and folders


uploadedFileName = secure_filename(file.filename)

uploadFolder = os.getcwd() + '/app/upload'


tempFolder = os.getcwd() + '/app/upload/tmp'

if file.filename == '':
return redirect(request.url)
if file and allowed_file(file.filename):
if not os.path.exists(uploadFolder):
os.makedirs(uploadFolder, mode=0o777)
if not os.path.exists(tempFolder):
os.makedirs(tempFolder, mode=0o777)

tempCompletePath = os.path.join(tempFolder, uploadedFileName)


uploadCompletePath = os.path.join(uploadFolder, uploadedFileName)
file.save(tempCompletePath)

file_hash = hashlib.md5()
with open(tempCompletePath, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
file_hash.update(chunk)

filePresent = OriginalFiles.query.filter_by(md5=file_hash.hexdigest()).first()

latestRowCount = OriginalFiles.query.count()

if not filePresent:
os.replace(tempCompletePath, uploadCompletePath)
uploadFile = OriginalFiles(file_id=latestRowCount+1,fileName=uploadedFileName,
md5=file_hash.hexdigest())
mappedFile = MappedFiles(user_id=current_user.id, fileName=uploadedFileName,
original_id=latestRowCount+1)
db.session.add(uploadFile)
db.session.add(mappedFile)
db.session.commit()
else:
os.remove(tempCompletePath)
findFile = OriginalFiles.query.filter_by(md5=file_hash.hexdigest()).first()

existsInMapped = MappedFiles.query.filter_by(user_id=current_user.id,
original_id=findFile.file_id).first()

if (not existsInMapped):
mappedFile = MappedFiles(user_id=current_user.id, fileName=uploadedFileName,
original_id=findFile.file_id)
db.session.add(mappedFile)
db.session.commit()

return redirect(url_for('main.view'))

@main.route('/view')
@login_required
def view():
uploadedFiles = MappedFiles.query.filter_by(user_id=current_user.id)
return render_template('view.html', files=uploadedFiles)

@main.route('/download/<type>', methods=['GET','POST'])
@login_required
def download_file(type):
if request.method == 'POST':
print(request)
print(type)
if (type == '1'):
mapped_id = request.form.get('mapped_id')
upload_folder = os.getcwd() + '/app/upload'
uploadedFiles = MappedFiles.query.filter_by(mapped_id=mapped_id).first()
originalFiles = OriginalFiles.query.filter_by(file_id=uploadedFiles.original_id).first()
upload_folder += '/' + originalFiles.fileName
return send_file(upload_folder, as_attachment=True,
attachment_filename=uploadedFiles.fileName)
if (type == '0'):
file_id = request.form.get('file_id')
upload_folder = os.getcwd() + '/app/upload'
originalFiles = OriginalFiles.query.filter_by(file_id=file_id).first()
upload_folder += '/' + originalFiles.fileName
return send_file(upload_folder, as_attachment=True,
attachment_filename=originalFiles.fileName)
return redirect(url_for('main.home'))

@main.route('/admin/view')
@login_required
def admin_view():
uploadedFiles = MappedFiles.query.all();
originalFiles = OriginalFiles.query.all();
users = Users.query.all()
print(uploadedFiles)
print(originalFiles)
print(users)
return render_template('adminView.html', users=users, originalFiles=originalFiles,
files=uploadedFiles)
Models.py

from . import db
from flask_login import UserMixin

class Users(UserMixin, db.Model):


__tablename__ = 'users'

id = db.Column(db.Integer, primary_key=True)
# relationships = db.relationship("MappedFiles", back_populates="users", uselist = False)

email = db.Column(db.String(100), unique=True)

password = db.Column(db.String(100))

username = db.Column(db.String(1000))

class OriginalFiles(UserMixin, db.Model):


__tablename__ = 'original_files'

file_id = db.Column(db.Integer, primary_key=True)


# relationships = db.relationship("MappedFiles", back_populates="original_files", uselist = False)

fileName = db.Column(db.String(200))

md5 = db.Column(db.String(200))

class MappedFiles(UserMixin, db.Model):


__tablename__ = 'mapped_files'

mapped_id = db.Column(db.Integer, primary_key=True)

user_id = db.Column(db.Integer, db.ForeignKey('users.id'))


# users = db.relationship("Users", back_populates="mapped_files")

fileName = db.Column(db.String(200))

original_id = db.Column(db.Integer, db.ForeignKey('original_files.file_id'))


# original_files = db.relationship("OriginalFiles", back_populates="mapped_files")
WEB Templates of the project

Base.html

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Python Drive Storage</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" />
</head>

<body>
<section class="hero is-primary is-fullheight" style="background-color: black; text-emphasis-color:
grey;">

<div class="hero-head" >


<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<!-- <a href="https://share-drive-kbtk3mq6fq-uc.a.run.app">
<img src="../static/images/Logo.png" width="80" height="80">
</a> -->

<a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-


expanded="false">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navMenu" class="navbar-menu">
<div class="navbar-start">
{% if not current_user.is_authenticated %}
<a class="navbar-item" href="{{ url_for('main.index') }}">
Home
</a>
{% endif %}
{% if current_user.is_authenticated %}
<a class="navbar-item" href="{{ url_for('main.home') }}">
Home
</a>
<a class="navbar-item" href="{{ url_for('main.upload') }}">
Upload Files
</a>

<a class="navbar-item" href="{{ url_for('main.view') }}">


View Files
</a>

<a class="navbar-item" href="{{ url_for('main.admin_view') }}">


Admin View
</a>
{% endif %}

</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
{% if not current_user.is_authenticated %}
<a class="button is-light" href="{{ url_for('auth.register') }}">
Sign up
</a>
<a class="button is-light" href="{{ url_for('auth.login') }}">
Log in
</a>
{% endif %}
{% if current_user.is_authenticated %}
<a class="button is-light" href="{{ url_for('auth.logout') }}">
Log Out
</a>
{% endif %}
</div>
</div>
</div>
</div>
</nav>
</div>

<div class="hero-body">
<div class="container has-text-centered">
{% block content %}
{% endblock %}
</div>
</div>
</section>
<script>
document.addEventListener('DOMContentLoaded', () => {

// Get all "navbar-burger" elements


const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);

// Check if there are any navbar burgers


if ($navbarBurgers.length > 0) {

// Add a click event on each of them


$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {

// Get the target from the "data-target" attribute


const target = el.dataset.target;
const $target = document.getElementById(target);

// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');

});
});
}

});
</script>
</body>

</html>
Register.html

{% extends "base.html" %}

{% block content %}
<div class="column is-4 is-offset-4">
<h3 class="title">Register</h3>
<div class="box">
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification is-danger">
{{ messages[0] }}. Go to <a href="{{ url_for('auth.login') }}">login page</a>.
</div>
{% endif %}
{% endwith %}
<form method="POST" action="/register">
<div class="field">
<div class="control">
<input class="input is-large" type="email" name="email" placeholder="Email"
autofocus="">
</div>
</div>

<div class="field">
<div class="control">
<input class="input is-large" type="text" name="username" placeholder="Username"
autofocus="">
</div>
</div>

<div class="field">
<div class="control">
<input class="input is-large" type="password" name="password"
placeholder="Password">
</div>
</div>
<button class="button is-rounded is-success is-outlined is-large is-fullwidth">Register</button>
</form>
</div>
</div>
{% endblock %}
AdminView.html

{% extends "base.html" %}

{% block content %}
<article class="message is-dark">
<div class="message-header">
<p>Users</p>
</div>
<div class="message-body">
<div class="table-container">
<table class="table is-striped is-narrow is-hoverable is-fullwidth">
<thead>
<tr>
<th>Sr. No.</th>
<th>Username</th>
<th>Email</th>
<th></th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<th>{{ loop.index }}</th>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<form method="" action="#">
<td>
<input type="hidden" value="{{ users.id }}" name="id" />
<button class="button is-link is-danger is-outlined" type="submit">Delete</button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</article>

<article class="message is-dark">


<div class="message-header">
<p>Original Files</p>
</div>
<div class="message-body">
<div class="table-container">
<table class="table is-striped is-narrow is-hoverable is-fullwidth">
<thead>
<tr>
<th>Sr. No.</th>
<th>File ID</th>
<th>File Name</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for file in originalFiles %}
<tr>
<th>{{ loop.index }}</th>
<td>{{ file.file_id }}</td>
<td>{{ file.fileName }}</td>
<form method="POST" action="/download/0">
<td>
<input type="hidden" value="{{ file.file_id }}" name="file_id" />
<button class="button is-link is-outlined" type="submit"
download="files.fileName">Download</button>
</td>
</form>
<form method="" action="#">
<td>
<input type="hidden" value="{{ users.id }}" name="id" />
<button class="button is-link is-danger is-outlined" type="submit">Delete</button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</article>

<article class="message is-dark">


<div class="message-header">
<p>Mapped Files</p>
</div>
<div class="message-body">
<div class="table-container">
<table class="table is-striped is-narrow is-hoverable is-fullwidth">
<thead>
<tr>
<th>Sr. No.</th>
<th>Uploaded File ID</th>
<th>Uploaded By User(ID)</th>
<th>File Name</th>
<th>Original File ID (Mapped)</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<th>{{ loop.index }}</th>
<td>{{ file.mapped_id }}</td>
<td>{{ file.user_id }}</td>
<td>{{ file.fileName }}</td>
<td>{{ file.original_id }}</td>
<form method="POST" action="/download/1">
<td>
<input type="hidden" value="{{ file.mapped_id }}" name="mapped_id" />
<button class="button is-link is-outlined" type="submit"
download="files.fileName">Download</button>
</td>
</form>
<form method="" action="#">
<td>
<input type="hidden" value="{{ users.id }}" name="id" />
<button class="button is-link is-danger is-outlined" type="submit">Delete</button>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</article>
{% endblock %}
Login.html

{% extends "base.html" %}

{% block content %}
<div class="column is-4 is-offset-4">
<h3 class="title">Login</h3>
<div class="box">
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification is-danger">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="/login">
<div class="field">
<div class="control">
<input class="input is-large" type="text" name="username" placeholder="Username"
autofocus="">
</div>
</div>

<div class="field">
<div class="control">
<input class="input is-large" type="password" name="password" placeholder="Your
Password">
</div>
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox">
Remember me
</label>
</div>
<button class="button is-rounded is-success is-outlined is-large is-fullwidth">Login</button>
</form>
</div>
</div>
{% endblock %}

Upload.html

{% extends "base.html" %}

{% block content %}
<div class ="container">
<div id="uploadFile" >
<h3 class="title">Upload File</h3>
<h1 class="subtitle">Allowed extensions {<strong> .txt </strong>} {<strong> .pdf </strong>}
{<strong> .png </strong>} {<strong> .jpg </strong>} {<strong> .jpeg </strong>} {<strong> .gif
</strong>} </h1>
<div class="box">
<form method="POST" enctype="multipart/form-data" action="/upload"}}">
<div class="field">
<div class="file is-centered has-name">
<label class="file-label">
<input class="file-input" type="file" name="file">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
<span class="file-name" >
Selected File Name ...
</span>
</label>
</div>
</div>
<button class="button is-rounded is-success is-outlined is-medium">Submit</button>
</form>
</div>
</div>
</div>
<script>
const fileInput = document.querySelector('#uploadFile input[type=file]');
fileInput.onchange = () => {
if (fileInput.files.length > 0) {
const fileName = document.querySelector('#uploadFile .file-name');
fileName.textContent = fileInput.files[0].name;
}
}
</script>
{% endblock %}

View.html

{% extends "base.html" %}

{% block content %}
<div class="column is-14">
<h3 class="title">Uploaded File</h3>
<div class="box" style="margin-left:25%; width: 50%;">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr">
<th>Sr. No.</th>
<th>Files</th>
<th></th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<th>{{ loop.index }}</th>
<td>{{ file.fileName }}</td>
<form method="POST" action="/download/1">
<td>
<input type="hidden" value="{{ file.mapped_id }}" name="mapped_id" />
<button class="button is-link is-outlined" type="submit"
download="file.fileName">Download</button>
</td>
</form>
</tr>
{%endfor%}
</tbody>
</table>
</div>
</div>

{% endblock %}
CHAPTER 4
FEATURE EXTRACTIONS

INTRODUCTION
In this chapter, there is detailed explanation of the features found in my Python file
management system:

1. File Creation:
Prompt the user to enter a file name and extension.
Verify the validity of the file name and extension, ensuring they meet naming conventions
and do not contain invalid characters.
Use the open() function to create a new file with the specified name and extension.
Handle exceptions if the file creation fails due to issues like insufficient permissions or an
invalid file path.

2. File Deletion:

Accept a file name or path from the user.


Check if the file exists and confirm the deletion action with the user.
Use the os.remove() function to delete the specified file.
Handle exceptions if the file deletion encounters errors, such as a file not found or a
permission denied.

3. File Renaming:
Prompt the user to enter the current file name and the desired new name.
Validate the file names, ensuring they meet naming conventions and do not conflict with
existing files.
Use the os.rename() function to rename the file.
Handle exceptions if the renaming process encounters issues, such as an invalid file name
or a file not found.
4. File Copying and Moving:

Accept the source file path and the destination path from the user.
Verify the validity of the source and destination paths, ensuring they point to existing files
or directories.
Use the shutil.copy() function to make a copy of the file, or shutil.move() function to move
the file.
Handle exceptions if the copying or moving operation fails due to errors like invalid paths
or insufficient permissions.

5. File Searching:

Prompt the user to enter search criteria such as file name or extension.
Recursively search directories for files that match the specified criteria.
Display search results, including file names, paths, and other relevant information.
Allow the user to refine search options and navigate through search results.

6. Directory Operations:

Provide options for creating new directories or folders.


Allow the user to delete directories, including all files and subdirectories within them.
Implement a directory navigation system to move between directories and display the
current working directory.
Enable listing files and subdirectories within a directory, along with their attributes and
permissions.
7. File Metadata and Information:

Retrieve and display file attributes such as size, creation date, and modification date.
Provide information about file permissions and ownership, including read, write, and
execute permissions for the owner, group, and others.
Allow the user to modify file permissions, if permitted by the underlying operating system
or filesystem.
These features can be implemented using appropriate Python modules and functions such
as os, shutil, and pathlib, among others. It's important to handle exceptions and errors
gracefully to ensure a robust file management system.
4.1 USER INTERFACE (UI)
User Interface, containing various style figure windows of user interface objects. For
creating a good UI, each object must be programmed to activate user interface.
.

4.1.1 UI DESIGN

The next stage was to design a UI which was simple yet informative.
The Terminal
Login page
Register Page
Upload Panel
View Files
Admin Panel
Welcome Page
CHAPTER 5
RESULTS AND DISCUSSION

5.1 EXPERIMENTS AND ANALYSIS

To provide results and initiate a discussion on a Python file management system, we can discuss its
functionality, benefits, and potential use cases. Here are some key points for consideration:

Functionality:

The file management system offers various features such as file creation, deletion, renaming, copying,
moving, searching, and directory operations.
It allows users to interact with files and directories, perform common file management tasks, and
retrieve file metadata.
The system ensures error handling and provides informative messages in case of any issues.

Benefits:

Enhanced productivity: The system simplifies file operations, saving time and effort for users.
Organization: Users can create, delete, and manage files and directories efficiently, maintaining
a well-structured file system.

Automation: The system can automate repetitive tasks, such as batch renaming or copying
multiple files simultaneously.

Use Cases:

File backup and synchronization: Users can copy or move files to different locations for backup or
synchronization purposes.

File sorting and organization: The system allows users to organize files into directories based on
specific criteria or search for specific files within a directory.

File manipulation: Users can rename files in bulk, delete unnecessary files, or perform other file
operations in a systematic manner.

Discussion:
User Experience: The system should provide a user-friendly interface, with clear instructions and error
handling to ensure a smooth user experience.
Security Considerations: The system should implement appropriate access controls and permissions
to prevent unauthorized access or modification of files.

Scalability: The system should be capable of handling a large number of files and directories
efficiently, without significant performance degradation.

Cross-Platform Compatibility: Ensuring the system works seamlessly across different operating
systems is important for wider adoption.

Overall, a Python file management system can significantly simplify file-related tasks, improve
organization, and enhance productivity. It can be adapted and expanded based on specific needs and
requirements, providing a flexible solution for effective file management in various scenarios.

5.2 FAILURE ANALYSIS

When analyzing the failure of a Python file management system, it's important to consider
potential areas where issues might arise. Here are some common failure points and possible
causes:

Error Handling:

Inadequate error handling: Insufficiently handling exceptions and error conditions can lead
to unexpected program termination or confusing error messages for users.

Lack of input validation: Failing to validate user input properly may result in unexpected
behavior or errors when performing file operations.

Permissions and Access:

Insufficient permissions: If the user running the file management system lacks the necessary
permissions to perform specific file operations, such as deleting or moving files, the system
may encounter errors or fail to complete the requested actions.

File locking: If a file is locked by another process or user, attempting to perform operations
on it may fail or result in inconsistent behavior.

Directory Structure:

Inconsistent or invalid directory paths: Providing incorrect or non-existent directory paths


can lead to errors when attempting to create, delete, or access files within those directories.
Incompatibility across platforms: Differences in file system structures and path
conventions across operating systems can cause issues if the system is not designed to handle
these variations.

File Handling:

Concurrent access: If multiple processes or users attempt to perform conflicting operations


on the same file simultaneously, issues such as data corruption or incomplete operations can
occur.

Unsupported file types or formats: If the file management system does not handle specific
file types or formats appropriately, it may fail to process those files or encounter unexpected
errors.

File System Limitations:

Limitations imposed by the underlying file system: Certain file system limitations, such as
maximum file size, maximum number of files in a directory, or maximum path length, may
cause failures if the system exceeds these limitations without appropriate checks or handling.

To address these potential failures, it is crucial to implement robust error handling


mechanisms, validate user input, ensure proper permission management, and account for
platform-specific variations. Thorough testing and incorporating user feedback can help
identify and resolve failure points, improving the overall reliability and stability of the file
management system.
CHAPTER 6

CONCLUSION AND FUTURE WORK

6.1 CONCLUSION

This chapter summarizes my work at every stage of the project. At the time I started my
thesis, I had a brief idea of how I will bring it from a topic on the paper to a real product.

In conclusion, a Python file management system provides a range of functionalities to


simplify file operations, enhance organization, and improve productivity. It allows users
to create, delete, rename, copy, move, search, and manage files and directories efficiently.
By automating common file-related tasks, it saves time and effort, resulting in a
streamlined workflow.

The system's benefits include improved organization, increased productivity, and the
ability to automate repetitive tasks. It enables users to back up files, sort and organize
them, and perform bulk operations with ease. The system's flexibility allows it to be
adapted to various use cases, such as file synchronization, batch renaming, or maintaining
a well-structured file system.

While analyzing potential failures, it's important to address issues related to error
handling, permissions and access, directory structure, file handling, and file system
limitations. Robust error handling, input validation, and appropriate permissions
management are essential to handle exceptions gracefully and provide a smooth user
experience. Accounting for platform-specific variations and considering potential
limitations of the underlying file system also contributes to system reliability.

Ultimately, a well-designed and properly implemented Python file management system


offers users a powerful tool for effectively managing their files and directories. With
careful consideration of failure points, continuous testing, and user feedback, the system
can provide a reliable and efficient solution for file management tasks.
FUTURE WORK

There are several potential areas for future work and enhancements in a Python file management
system. Here are some possibilities to consider:

Enhanced User Interface:


Improve the user interface to provide a more intuitive and user-friendly experience.
Implement graphical user interfaces (GUIs) to facilitate easier navigation and interaction with
files and directories.

Incorporate features such as drag-and-drop functionality for file operations.

Cloud Storage Integration:


Integrate with popular cloud storage platforms to enable seamless file management across local
and cloud storage systems.

Implement functionalities to upload, download, and synchronize files with cloud storage services.
Provide options for encryption and secure authentication when accessing cloud storage.

Version Control:
Implement version control capabilities to track and manage file revisions over time.
Allow users to view and revert to previous versions of files.

Support branching and merging of file versions for collaborative work.

File Metadata Extraction:


Enhance the system to extract and display additional metadata from files, such as author, creation
software, and keywords.

Implement support for extracting metadata from various file formats, including documents,
images, audio, and video files.

Batch Operations and Scripting:


Enable users to define and execute batch operations on multiple files or directories, saving time
and effort.

Provide scripting capabilities to automate complex file management workflows, allowing users to
create custom scripts for specific tasks.

File Content Analysis:


Integrate text or image recognition technologies to analyze and classify file content automatically.
Implement features to search for files based on content, such as searching for specific text within
documents or specific objects within images.

Cross-Platform Compatibility:

Ensure the file management system works seamlessly across different operating systems,
including Windows, macOS, and Linux.

Account for variations in file system structures, path conventions, and permission systems to
provide consistent functionality.

Performance Optimization:

Optimize file operations to handle large files or directories more efficiently.


Implement caching mechanisms to improve the speed of common file operations and reduce disk
I/O.

Error Reporting and Logging:

Enhance error reporting and logging mechanisms to provide more detailed and actionable error
messages.

Implement logging features to record file management activities and errors for auditing and
troubleshooting purposes.

These are just a few potential areas for future work in a Python file management system. The
specific direction and prioritization of future enhancements would depend on the intended use
cases, user feedback, and the evolving needs of the users.
REFERENCES

[1] PHP book by Vasvani(TMH publications).

[2] Beginning PHPS by WROX

[3] www.google.com

[4] www.wikipedia.com

[5] YouTube

[6] www.aspforums.net

[7] www.forums.tutorialized.com

[8] http://www.w3schools.com/html/html_intro.asp

[9] http://www.w3schools.com/css/css_background.asp

[10] http://www.w3schools.com/js/js_datatypes.asp

[11] http://www.w3schools.com/sql/sql_insert.asp

[12] http://www.w3schools.com/sql/sql_update.asp

[13] http://www.w3schools.com/php/php_forms.asp

[14] Fundamentals of software engineering by Rajib mall, PHIlearning

[15] Web development and application development by Ivan Byross BPB


publications

You might also like