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

Workshop 1

The document outlines a workshop focused on creating a Shell script for automated file and directory management. The script should sort files by type into designated subfolders and generate a report detailing the operations performed. Key features include argument validation, file type identification, and the creation of a summary report with execution details.
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)
6 views1 page

Workshop 1

The document outlines a workshop focused on creating a Shell script for automated file and directory management. The script should sort files by type into designated subfolders and generate a report detailing the operations performed. Key features include argument validation, file type identification, and the creation of a summary report with execution details.
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/ 1

Module : System and Scripting

Workshop 1: Automated File and Directory Management


Objectives

The goal is to develop a Shell script that analyzes the contents of a given directory,
automatically sorts files by type, and organizes them into dedicated subfolders. At the end of
the process, an execution report will be generated to summarize the operations performed.

Features

1. The script must check for at least one argument; otherwise, it should display the usage
message on the error output and fail.
2. The script must verify if the argument exists and whether it is a directory. If not, it should
prompt the user to provide the name of an existing directory. It must then scan all files within
this directory (without descending into subdirectories).
3. The script must identify the file type based on its extension or by using the file or mimetype
command.
4. The script must classify files into the following categories:
o Text: .txt, .md, .csv, .log
o Images: .jpg, .jpeg, .png, .gif, .bmp
o Videos: .mp4, .avi, .mkv, .mov
5. The script must create the corresponding subfolders if they do not exist and move the files into
their respective subfolders.
6. The script must generate a text file script_report.txt containing:
o The total number of files processed.
o The number of files per category.
o The date and time of script execution.

Guidelines

 To execute and test the requested script, a test environment must be prepared. This consists of
a directory inside the user's home directory that contains files of different types as indicated in
the script (images, videos, etc., can be downloaded).
 The code must be well-structured and commented.

You might also like