0% found this document useful (0 votes)
9 views

OSY MicroProject

The document outlines a micro-project proposal for creating a File Operation application using shell scripting on Unix/Linux systems. It details the project's aim, literature review on shell scripting and file management, an action plan, required resources, and a proposed methodology for file operations. The report also includes sample code for the application and demonstrates its functionality through a user interface.

Uploaded by

snehatumaskar
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)
9 views

OSY MicroProject

The document outlines a micro-project proposal for creating a File Operation application using shell scripting on Unix/Linux systems. It details the project's aim, literature review on shell scripting and file management, an action plan, required resources, and a proposed methodology for file operations. The report also includes sample code for the application and demonstrates its functionality through a user interface.

Uploaded by

snehatumaskar
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/ 16

PART A – Micro-Project Proposal

An File Operation application using shell scripting

1. Brief Introduction
A File Operation application using shell scripting is a program that automates various file-
related tasks and operations on a Unix or Linux-based system. Shell scripting involves writing
a series of commands in a script file that can be executed in the system's shell, often using the
Bash shell. This application is a powerful tool for managing files and directories, performing
tasks like file creation, deletion, copying, moving, searching, and more, all in an automated
and efficient manner.

2. Aim of the Micro-Project


An File Operation application using shell scripting

3. Literature Review

Shell Scripting:
Shell scripting plays a fundamental role in this project. Shell scripts are lightweight,
text-based programs that execute commands in a Unix-like operating system. The use
of shell scripting facilitates the automation of repetitive tasks, making it an essential skill
for system administrators and developers. Bash, as the chosen shell in the project, is a
widely-used shell on Unix-based systems and offers a robust scripting environment.

File and Directory Management:


The project's primary objective is to provide a tool for effective file and directory
management. Shell scripting, with its ability to interact with the filesystem, allows users
to perform tasks such as listing directory contents, changing directories, creating files
and directories, copying, moving, renaming, searching for files, and deleting files and
directories. Each of these functions is integral to daily system administration and data
organization.
File operations:
File operations in shell scripting involve performing various tasks related to files
and directories in a Unix-like operating system. These operations are essential for
managing data and automating tasks. Common file operations in shell scripting include
listing directory contents, changing directories, creating files and directories, copying,
moving, renaming, searching for files, and deleting files and directories. Shell scripts
use commands and system calls to execute these operations, providing a versatile and
customizable way to interact with the filesystem.

4.A Action Plan

Name of
Details of Planned Start Planned Finish
Sr. No. Responsible
Activity Date Date
Team Members

Collect
1 information about All
our topic.
Formulating
problem
2 Samir Mule
definition and
prepare proposal.

Finding the Sakshi Khole,


3
information Anushka Jain

Coding the
Rushikesh
4 program in Shell
Burankar
scripting

Testing the
5 Srujal Audarya
program.

Debugging the Rushikesh


6
program. Burankar

Final Report
7 All
Presentation.
5.R Resources Required

Name of
Sr. No. Specifications Quantity Remarks
Resource
Computer (intel
1 Computer System i5 10th gen), RAM 1
8GB

2 Operating system Ubuntu 1

Any other Browser,


3 As required
resources used Reference Book
MICRO-PROJECT REPORT ON

“An File Operation application using shell scripting”

In partial fulfilment of Diploma in Computer Engineering


(Fifth Semester)

In the subject of
Operating Systems(23516)

Submitted By
1. Srujal Audarya
2. Samir Mule
3. Sakshi Khole
4. Rushikesh Burankar
5. Anushka Jain

Submitted To

Maharashtra State Board of Technical Education, Mumbai (M.S)


Under the Guidance of

Mr.M.R.Torney
Lecturer In
Department of Computer Engineering
Government Polytechnic Arvi Dist.-Wardha
(2023-2024)
Government Polytechnic, Arvi
Department of Computer Engineering

Certificate

This is to certify, that students whose name is mention below of Fifth Semester
of Diploma in Computer Engineering has satisfactorily completed the Micro-
project entitled “An File Operation application using shell scripting” in
Operating Systems of the academic year 2023-24 as prescribed in MSBTE
curriculum.

Name Enrolment No. Seat No.


Srujal Audarya 2101320104 297651
Samir Mule 2101320105 297652
Sakshi Khole 2101320108 297653
Rushikesh Burankar 2101320111 297654
Anushka Jain 2101320112 297655

Subject Teacher Head of the Department Principal

Place: Arvi
Date:
Declaration

We under signed hereby declare that the micro-project report entitled “An File
Operation application using shell scripting”. We further declare that contents
of this report are properly citied and well acknowledge. This present report is not
submitted to any other examination of this or any other institute for the award of
any diploma.

1. Srujal Audarya

2. Samir Mule

3. Sakshi Khole

4. Rushikesh Burankar

5. Anushka Jain

Signature

Place: Arvi
Date:
PART B – Micro-Project Report
An File Operation application using shell scripting

1. Rationale

Shell scripting is a method of writing a series of commands and instructions in


a script file, typically using a shell like Bash in Unix-like operating systems. These scripts
can automate various tasks, ranging from simple to complex, and are often used for system
administration, software development, and general automation. Shell scripts provide a way
to execute commands and perform operations in a sequential and repeatable manner, making
them valuable for streamlining tasks and workflows.
File Operation application using shell scripting is that it allows users to achieve
consistency and reliability in their file management processes. Shell scripts provide a
flexible and adaptable solution for handling specific file and directory tasks, fostering
problem-solving and critical thinking skills. Moreover, the creation of these applications
can serve as valuable hands-on experience for building a portfolio and demonstrate practical
capabilities in a professional or educational context. Finally, shell scripting can contribute
to enhancing security through the enforcement of access controls and data protection during
file operations.

2. Aim of Micro Project


An File Operation application using shell scripting

3. Course Outcomes Integrated

C.O. b. Use operating system tools to perform various functions.


C.O. f. Apply file management techniques

4. Literature Review

Shell Scripting:
Shell scripting plays a fundamental role in this project. Shell scripts are lightweight,
text-based programs that execute commands in a Unix-like operating system. The use
of shell scripting facilitates the automation of repetitive tasks, making it an essential skill
for system administrators and developers. Bash, as the chosen shell in the project, is a
widely-used shell on Unix-based systems and offers a robust scripting environment.
File and Directory Management:
The project's primary objective is to provide a tool for effective file and directory
management. Shell scripting, with its ability to interact with the filesystem, allows users
to perform tasks such as listing directory contents, changing directories, creating files
and directories, copying, moving, renaming, searching for files, and deleting files and
directories. Each of these functions is integral to daily system administration and data
organization.

File operations:
Shell scripting are essential for working with files and directories in a Unix-like
operating system. Shell scripts provide a powerful and flexible way to interact with the
filesystem, enabling tasks such as creating, modifying, moving, and deleting files and
directories. Here are some common file operations in shell scripting:

5. Proposed methodology:

1.Listing Directory Contents:


The ls command is used to list the files and directories in the current directory.
Example: ls -l to list files with detailed information.

2.Changing Directories:
.The cd command is used to change the working directory.
Example: cd /path/to/directory to navigate to a specific directory.

3.Creating a New File:


The touch command creates a new empty file.
Example: touch newfile.txt creates a file named "newfile.txt."

4.Creating a New Directory:


The mkdir command is used to create a new directory.
Example: mkdir new_directory creates a directory named "new_directory."

5.Copying Files and Directories:


The cp command copies files or directories from a source location to a destination.
Example: cp sourcefile.txt destination/ to copy a file.

6.Moving Files and Directories:


The mv command moves files or directories from one location to another.
Example: mv file.txt destination/ moves a file.
7.Renaming Files and Directories:
Renaming is accomplished using the mv command by specifying the current name and
the new name.
Example: mv oldname.txt newname.txt renames a file.

8.Deleting Files and Directories:


The rm command removes files, and rm -r is used to remove directories and their
contents.
Example: rm file.txt deletes a file, and rm -r directory/ deletes a directory and its
contents.

6. Actual Resources Used

Name of
Sr. No. Specifications Quantity Remarks
Resource
Computer (intel
1 Computer System i5 10th gen), RAM 1
8GB

2 Operating system Ubuntu 1

Any other Browser,


3 As required
resources used Reference Book
Program:
#!/bin/bash

# Function to display the main menu


show_menu() {
echo "File Management Tool"
echo "1. List current directory"
echo "2. Change directory"
echo "3. Create a new file"
echo "4. Create a new directory"
echo "5. Copy file/directory"
echo "6. Move file/directory"
echo "7. Rename file/directory"
echo "8. Search for files"
echo "9. Delete file/directory"
echo "0. Exit"
}

# Function to list the contents of the current directory


list_directory() {
ls -l
}

# Function to change the working directory


change_directory() {
read -p "Enter the path of the directory: " dir_path
if [ -d "$dir_path" ]; then
cd "$dir_path"
echo "Changed directory to: $dir_path"
else
echo "Directory not found: $dir_path"
fi
}

# Function to create a new file


create_file() {
read -p "Enter the name of the new file: " file_name
touch "$file_name"
echo "New file created: $file_name"
}

# Function to create a new directory


create_directory() {
read -p "Enter the name of the new directory: " dir_name
mkdir "$dir_name"
echo "New directory created: $dir_name"
}

# Function to copy a file or directory


copy_file_or_directory() {
read -p "Enter the path of the source file/directory: " src_path
read -p "Enter the path of the destination directory: " dest_path
cp -r "$src_path" "$dest_path"
echo "Copied $src_path to $dest_path"
}

# Function to move a file or directory


move_file_or_directory() {
read -p "Enter the path of the source file/directory: " src_path
read -p "Enter the path of the destination directory: " dest_path
mv "$src_path" "$dest_path"
echo "Moved $src_path to $dest_path"
}

# Function to rename a file or directory


rename_file_or_directory() {
read -p "Enter the current name of the file/directory: " current_name
read -p "Enter the new name: " new_name
mv "$current_name" "$new_name"
echo "Renamed $current_name to $new_name"
}

# Function to delete a file or directory


delete_file_or_directory() {
read -p "Enter the path of the file/directory to delete: " del_path
if [ -e "$del_path" ]; then
rm -r "$del_path"
echo "Deleted: $del_path"
else
echo "File/directory not found: $del_path"
fi
}

# Main loop
while true; do
show_menu
read -p "Enter your choice (0-9): " choice

case "$choice" in
1) list_directory ;;
2) change_directory ;;
3) create_file ;;
4) create_directory ;;
5) copy_file_or_directory ;;
6) move_file_or_directory ;;
7) rename_file_or_directory ;;
8) delete_file_or_directory ;;
0) echo "Exiting..."; exit 0 ;;
*) echo "Invalid choice. Please try again." ;;
esac
echo ""
done

Output of the program:

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 1
total 8
-rwxrwxrwx 1 tuber-rishi tuber-rishi 3000 Oct 25 14:48 project.sh
-rwxrwxrwx 1 tuber-rishi tuber-rishi 67 Oct 6 20:38 rushi.sh

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 2
Enter the path of the directory: /home/tuber-rishi/Documents
Changed directory to: /home/tuber-rishi/Documents

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 2
Enter the path of the directory: /home/tuber-rishi/Documents/OSY
Changed directory to: /home/tuber-rishi/Documents/OSY

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 3
Enter the name of the new file: raju.txt
New file created: raju.txt

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 4
Enter the name of the new directory: raju
New directory created: raju

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 5
Enter the path of the source file/directory: /home/tuber-
rishi/Documents/OSY/rushi.sh
Enter the path of the destination directory: /home/tuber-
rishi/Documents/OSY/raju
Copied /home/tuber-rishi/Documents/OSY/rushi.sh to /home/tuber-
rishi/Documents/OSY/raju

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 6
Enter the path of the source file/directory: /home/tuber-
rishi/Documents/OSY/raju.txt
Enter the path of the destination directory: /home/tuber-
rishi/Documents/OSY/raju
Moved /home/tuber-rishi/Documents/OSY/raju.txt to /home/tuber-
rishi/Documents/OSY/raju

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 2
Enter the path of the directory: /home/tuber-rishi/Documents/OSY/raju
Changed directory to: /home/tuber-rishi/Documents/OSY/raju

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 1
total 4
-rw-rw-r-- 1 tuber-rishi tuber-rishi 0 Oct 25 15:12 raju.txt
-rwxrwxr-x 1 tuber-rishi tuber-rishi 67 Oct 25 15:13 rushi.sh

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 7
Enter the current name of the file/directory: /home/tuber-
rishi/Documents/OSY/raju/rushi.sh
Enter the new name: raju1.sh
Renamed /home/tuber-rishi/Documents/OSY/raju/rushi.sh to raju1.sh

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 8
Enter the path of the file/directory to delete: /home/tuber-
rishi/Documents/OSY/raju/raju1.sh
Deleted: /home/tuber-rishi/Documents/OSY/raju/raju1.sh

File Management Tool


1. List current directory
2. Change directory
3. Create a new file
4. Create a new directory
5. Copy file/directory
6. Move file/directory
7. Rename file/directory
8. Delete file/directory
0. Exit
Enter your choice (0-8): 0
Exiting...
7. Skill Developed

• Proficiency in shell scripting.


• Logic and problem-solving skills.
• File and directory operations.
• User interaction through menus and input.
• Error handling and resilience.
• Debugging skills.

8. Conclusion

Creating a File Operation application using shell scripting equips you with essential
skills in automation, problem-solving, and efficient file management, making you
proficient in working with Unix-like systems and enhancing your abilities in IT and
software development.

9. Reference

• https://www.tutorialspoint.com/unix/unix-file-operators.html
• https://www.geeksforgeeks.org/shell-script-to-perform-operations-on-a-file/
• https://www.techtarget.com/searchdatacenter/definition/shell-script
• https://chat.openai.com/c/cf59d293-7f08-4c2a-97b7-8067d7b8cebc

You might also like