0% found this document useful (0 votes)
23 views18 pages

Miniproject Report Format-1

This document describes the implementation of a File Backup Utility that uses the Google Drive API. It includes a MyDrive class to interface with the Drive API, with methods to list files, upload a file to a specified folder, and handle authentication via OAuth. The upload_file method checks if a file already exists before creating or updating it.

Uploaded by

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

Miniproject Report Format-1

This document describes the implementation of a File Backup Utility that uses the Google Drive API. It includes a MyDrive class to interface with the Drive API, with methods to list files, upload a file to a specified folder, and handle authentication via OAuth. The upload_file method checks if a file already exists before creating or updating it.

Uploaded by

GP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

FILE BACKUP UTILITY

Submitted by

JEYASHANCHITHA J (RA2211003020043)
SOHAN (RA2211003020052)
SAKSHI (RA2211003020049)

Under the guidance of

Dr. MANIRAJ S P

(Assistant Professor, Department of Computer Science and Engineering)


In partial fulfillment for the award of the degree
of

BACHELOR OF TECHNOLOGY
in

COMPUTER SCIENCE AND ENGINEERING


of

COLLEGE OF ENGINEERING AND TECHNOLOGY

RAMAPURAM, CHENNAI-600089

OCTOBER 2023

1
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

(Deemed to be University Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified that the Mini Project titled “FILE BACKUP UTILITY” is the bonafide
certificate of JEYASHANCHITHA J RA2211003020043, SOHAN
RA2211003020052, SAKSHI RA2211003020049 of II Year CSE/Specialization
submitted for the course 21CSC202J Operating Systems for the Academic Year 2023
– 24 Odd Semester.

SIGNATURE

Assistant Professor
Computer Science & Engineering
SRM Institute of Science and
Technology Ramapuram, Chennai.

2
SCOPE AND OBJECTIVE:

1. INTRODUCTION: This section provides an overview of the File Backup Utility,


outlining its purpose and significance.

2. PURPOSE: Describe the primary aim of the File Backup Utility, which is to ensure
the safety and accessibility of critical data.

3. OBJECTIVE: List the specific goals of the File Backup Utility, such as data
protection, disaster recovery, and efficient file management.

4. SCOPE: Define the boundaries of the File Backup Utility, specifying what data it
covers, which platforms it supports, and the intended user base.

5. KEY FEATURES: Enumerate the essential functionalities, including automatic


backup scheduling, version control, and user-friendly interfaces.

3
6. SYSTEM REQUIREMENTS: Detail the hardware and software prerequisites
necessary for using the File Backup Utility effectively.

7. DATA BACKUP PROCESS: Explain the step-by-step procedure of how the


utility performs data backups, emphasizing the reliability and security of the
process.

8. DATA RESTORATION PROCESS: Describe how users can recover data from
backups, focusing on ease of use and ensuring minimal downtime.
9. CONCLUSION: Summarize the importance of the File Backup Utility in data
management and emphasize its role in safeguarding critical information.

This structure outlines the scope and objectives of a File Backup


Utility comprehensively, ensuring clarity and transparency in its purpose and
functionality.

4
DESCRIPTION

Introduction:

A file backup utility is an essential tool for individuals and organizations to ensure the
safety and security of their digital data. In this comprehensive guide, we will explore the
concept of file backup utilities, their importance, and how they function to safeguard
your files and data.

I. Understanding File Backup Utilities

1.1 What is a File Backup Utility?

Definition: A file backup utility is software designed to create copies of digital files,
documents, and data to protect against data loss, hardware failure, accidental deletion, or
other unforeseen events.

Purpose: The primary purpose of a backup utility is to provide a safety net for your
valuable data, ensuring it can be restored in case of emergencies.

1.2 Why Are File Backup Utilities Essential?

Data Loss Prevention: They prevent the loss of important data due to various factors,
such as hardware failures, software errors, and user mistakes.

Disaster Recovery: File backup utilities are essential for disaster recovery, allowing
users to recover their data after catastrophic events like fires, floods, or cyberattacks.

5
Peace of Mind: Users can work without worry, knowing that their files are protected
and can be restored at any time.

II. Types of File Backup Utilities

2.1 Full Backup:

Explanation: A full backup utility copies all selected files and data in their entirety. It
provides complete data redundancy but consumes more storage space.

2.2 Incremental Backup:

Explanation: Incremental backups only copy the data that has changed since the last
backup. They save storage space but may require more time for data restoration.

2.3 Differential Backup:

Explanation :Differential backups capture all changes since the last full backup,
making restoration faster than incremental backups.

III. Features and Functionality

3.1 Scheduling Backups:

Explanation: File backup utilities allow users to schedule automated backups at


specified intervals, ensuring data is consistently backed up without manual intervention.

3.2 Encryption:
6
Explanation: Many backup utilities offer encryption options to secure backed-up data
from unauthorized access.

3.3 Compression:

Explanation: Data compression reduces the size of backups, saving storage space and
speeding up the backup process.

IV. Popular File Backup Utilities

4.1 Windows Backup and Restore:

Explanation: A built-in utility for Windows OS, it allows users to create backups of
files and system images.

4.2 Time Machine (macOS):

Explanation: Time Machine is an integrated backup utility for macOS that offers
easy, automatic, and incremental backups.

4.3 Acronis True Image:

Explanation: Acronis True Image is a comprehensive backup utility with features like
disk cloning and cloud backup.

V. Best Practices for Using File Backup Utilities

7
5.1 Regular Backups:

Explanation: It's crucial to establish a routine for backups, ensuring that data is up to
date and readily restorable.

5.2 Multiple Backup Locations:

Explanation: Store backups in multiple locations, including external drives and cloud
storage, to enhance redundancy.

Conclusion:

File backup utilities are indispensable tools for safeguarding your digital files and data.
They offer a layer of protection against data loss and ensure business continuity in times
of crisis. By understanding the types, features, and best practices associated with these
utilities, you can ensure the safety and accessibility of your digital assets

8
IMPLEMENTATION

import pickle
import os.path
from googleapiclient.discovery import build
from google_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from apiclient.http import MediaFileUpload
import os

class MyDrive():
def__init__(self):
# If modifying these scopes, delete the file token.pickle
SCOPES =["https://www.googleapis.com/auth/drive ']
“””Shows basic usage of the Drive v3 API.

Prints the names and ids of the first 10 files the user has access to.
“””

creds = None

#The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
#time.

if os.path.exists("token.pickle'):

with open('token.pickle", "rb") as token:

creds pickle.load(token)

#If there are no (valid) credentials available, let the user log in.

if not creds or not creds.valid:

if creds and creds.expired and creds.refresh_token:


creds.refresh(Request())
9
else:

flow = InstalledAppFlow.from_client_secrets_file(

'credentials.json' , SCOPES)

creds = flow.run_local_server (port=0)

# Save the credentials for the next run


with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)

self.service = build('drive', 'v3', credentials=creds)

def list_files(self, page_size=10):


# Call the Drive v3 API

results = self.service.files().list(

pageSize=page size, fields="nextPageToken, files (id,


name)").execute()

items = results.get('files', [])

if not items:

print('No files found.")

else:

print("Files:')

for item in items:


print(u'{0} ({1})'.format(item['name'], item['id']))

def upload_file(self, filename, path):


folder_id = "1XLeFvsgBbnagvMM20ptRH3PANNK6QDDE"
10
media = MediaFileUpload(f”{path}{file_name}”)
response = self.service.files().list(
q=f"name="{file_name}' and parents='(folder_id}"

spaces='drive',

fields='nextPageToken, files (id, name)",

pageToken=None).execute()
if len(response[‘files’]) == 0:
file_metadata= {

'name': filename,

'parents':[ folder_id]
}

file= self.service.files().create(body-file_metadata, media_body-


media, fields='id').execute()
print (f"A new file was created {file.get('id')}")
else:
for file in response.get('files', []):

# Process change

update_file = self.service.files().update(

fileId=file.get('id'),

media_body=media,

).execute()

print(f'Updated File')
def main():
path= ”c:/Users/programmer/Desktop/Backup/”
files = os.listdir(path)
11
my_drive= MyDrive()
#my_drive.list_files()

for item in files:


my_drive.upload_file(item, path)

if__ name__ == '_main_':


main()

OUTPUT

12
13
14
15
In this code:
• source_directory should be replaced with the path to the directory you want to
back up.
• destination_directory should be replaced with the path where you want to store
the backup copies.
When you run this code, it will copy all the files from the source directory to the
destination directory, effectively creating a backup. The shutil.copy2 function is used to
copy the files while preserving their metadata (timestamps, permissions, etc.).
Ensure that you have appropriate permissions to read from the source directory and
write to the destination directory. Additionally, you may want to add error handling and
more advanced features depending on your specific use case.

16
RESULT:
In conclusion, a file backup utility is a vital component of digital data
management for individuals, businesses, and organizations. Its role in data protection,
disaster recovery, and peace of mind cannot be overstated. By regularly employing
backup strategies such as full, incremental, or differential backups, scheduling
automated backups, and utilizing encryption and compression, users can ensure the
safety and integrity of their critical data.

The availability of various backup utilities, both integrated into operating systems and
third-party options, empowers users with flexibility and choice in safeguarding their
information. Whether you rely on Windows Backup and Restore, Time Machine for
macOS, or more comprehensive solutions like Acronis True Image, the key is to
establish a backup regimen that suits your specific needs and preferences.

By adhering to best practices, such as regular backups and diversifying storage


locations, you can fortify your data against unexpected events, thereby enhancing your
overall data resilience. A well-executed backup strategy serves as a dependable safety
net, offering peace of mind in the ever-evolving digital landscape where data is king.

17
THANK YOU

18

You might also like