Question: Write a python script that implements a function to backup files in a given directory. Your function should accept as inputs, a folder to be

Write a python script that implements a function to backup files in a given directory. Your function should accept as inputs, a folder to be backed up and the destination folder in which files would be backed up to. Your code will need to be able to handle situations where the source and destination folders do not exist. For testing purposes, create two directories in your project directory. In one of the directories(your source directory) use the touch Linux command to create four arbitrary files. Your code should have a second function that accepts a directory as an argument and creates an archive out of the contents of the directory. Your function should prompt the user to enter the type of archive to be created. Use exception handling to handle situations where the directory to be backed up and archive type to do not exist. Valid archive types are zip,gztar,tar,bztar and xztar. Ensure that a valid archive type is provided by the user. Your code should have a third function that takes a given zip file as argument and displays the OS and file size ( Kilobytes) of all files with sizes greater than a given threshold(in KB). Your function should be flexible enough to allow the user to indicate the threshold. Lastly, make sure you have a 4th function that allows the user to select and implement one of the 3 functions above. Make sure that the use chooses a valid option.

Hint: Please remember the OS reports size of files in bytes and a Kilobyte is 1024bytes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!