Script: In this section of your final project, you will write a basic script to
ID: 3698873 • Letter: S
Question
Script: In this section of your final project, you will write a basic script to create and back up files. You will create this script with the vi editor. The script will combine multiple commands and simplify a repeatable task. Your script should be named Firstname Lastname.BASH. Your script and your Linux directory structure should demonstrate that you have correctly written the script to do the following: Create files: In this section, you will demonstrate your ability to utilize various Linux commands to create text files. Create these files in the NEW directory. Ensure that the commands in your log file show that the following three text files were created using three different methods. Create the following files XI A. A text file listing the quantity of operating system free space, titledFree_Space Content.txt B. A text file listing the directory contents of the OLD folder, titled OLD_Content.txt C. A text file showing the current month, day, and time (Title this fileTime File.tx.) XI Modify and Move files: Utilize Linux commands to copy files to a different directory and renamethem A. Copy the following selected files from the OLD directory to the BACKUP directory. Ensure that you change the filename suffix fro XXX OLD to XXX BACKUP i. Free_Space_Content OLD.txt ii Directory Content OLD.txt i Time File OLD.txt Move all files from the NEW directory to the BACKUP directory (no renaming necessary). Clean up the Linux directory structure by deleting the items in the NEW directory B.Explanation / Answer
#!/bin/bash
df > Free_Space_Content.txt
ls ./OLD > OLD_Content.txt #here ./OLD should be replaces with OLD folders actual location
date +%m-%d-%T > Time_file.txt
mv ./OLD/Free_Space_Content_OLD.txt ./BACKUP/Free_Space_Content_BACKUP.txt
mv ./OLD/Directory_Content_OLD.txt ./BACKUP/Directory_Content_BACKUP.txt
mv ./OLD/Time_File_OLD.txt ./BACKUP/Time_File_BACKUP.txt
mv ./NEW/* ./BACKUP/
#please replace the NEW,OLD,and BACKUP folders location with your systesm location.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.