Use Shutil Modecreate Script Called Copyactivitiespy Function Called Stuactivities Followi Q43782533
Use shutil mode.Create a script calledcopy_activities.py with a function called stu_activities that doesthe following:
Finds files in ~/Downloads that contain the string Stu_Copies these files (using the folders naming convention) into thecorrect Week and Day directory within the CyberSecurity-Notesdirectory created in part 1.
This question has been posted but does not copy anythingto the files
This is what i have already created they need to be copied intothese dir
Create a script called create_notes_drs.py . In the file, defineand call a function called main that does the following: Creates adirectory called CyberSecurity-Notes in the current workingdirectory Within the CyberSecurity-Notes directory, creates 24sub-directories (sub-folders), called Week 1 , Week 2 , Week 3 ,and so on until up through Week 24 Within each week directory,create 3 sub-directories, called Day 1 , Day 2 , and Day 3
my code for this
import os
def main():
#Storring folder name into avariable
mainDir = “CyberSecurity-Notes”
#isdir will check if the is an existingpath
if os.path.isdir(mainDir):
print(“Directoryalready exists”)
os.mkdir(mainDir) #creating the dir ifit dint find a file name
#This loop will create a folder 24times
for week in range(1,25):
os.mkdir(“{}/Week{}”.format(mainDir,week))
#this folderwill loop 3 times ceating the days folder before it loops again inthe week loop
for day inrange(1,4):
os.mkdir(“{}/Week{}/Day{}”.format(mainDir,week,day))
main()
Expert Answer
Answer to Use shutil mode.Create a script called copy_activities.py with a function called stu_activities that does the following:…
OR