Business

Python TASK: Backup Script- Name this file lab8e.py.- This script should expect one command line argument from the user. This command line argument should be the name of a directory. If this is not a valid directory, print an appropriate error message and exit. HINT: explore the os.path module for ways to check if a string is a valid directory.- First, save the absolute filepath that corresponds to the user-defined directory.- Your script should verify that a directory called backups exists as a subdirectory of the user-defined filepath. If it doesnt exist, create it.- Use the absolute filepath inside os.walk.- For each file, check if the file is a Python script (ends in .py). Use whatever method you like to verify this.- If the file is a python script, make a copy of it in the backups directory.- If the file is not a python script, ignore it and move on.Some things to keep in mind:- You will notice that copy is not on the list of functions that os provides to you. You will need to research the shutil module, which contains more functions. A function called copy() can be found there. As always, take at least a few minutes to read the docs!- Your script should work on Windows, Mac or Linux. Avoid using os.system for this task.- As you copy files into your backups directory, the contents of your target directory will start to change. You will need to exclude any file that is found inside the backups directory itself!- What if your target directory has several files with the same name? This is a situation wed have to address in a more fully-formed project, but for now you might want to consider renaming those files or moving them to another location. You might want to read the docs to discover what will happen when you try copying to a location that already contains a file with that name.- Remember to check the existing methods inside os for help!