Professional Documents
Culture Documents
TAXILA
SUBMITTED TO:
MAAM SABA AWAN
SUBMITTED BY:
JAVARIA TABASSUM
REGISTRATION NO:
22-SE-33
ASSIGNMENT
# Main function
main() {
while true; do
echo "Select an operation:"
echo "1. List directories recursively"
echo "2. Print files in a directory recursively"
echo "3. Move files with specific extension"
echo "4. Delete files with specific extension"
echo "5. Exit"
read -p "Enter your choice (1, 2, 3, 4, or 5): " choice
case $choice in
1)
read -p "Enter the directory to list recursively: " directory
list_directories "$directory"
;;
2)
read -p "Enter the directory: " directory
print_files_recursively "$directory"
;;
3)
read -p "Enter the source directory: " source
read -p "Enter the destination directory : " destination
read -p "Enter the file extension to move (e.g., txt, jpg): " extension
move_files "$source" "$destination" "$extension"
;;
4)
read -p "Enter the directory: " directory
read -p "Enter the file extension to delete: " extension
delete_files "$directory" "$extension"
;;
5)
echo "Exiting the program."
exit
;;
*)
echo "Invalid choice. Please enter a number between 1 and 5."
;;
esac
done
}
OUTPUT