The purpose of this assignment is to learn how write basic scripts using the Python programming language.
Here is a program named “walk“. Your TA will discuss it.
#! /usr/bin/python3 import os for dirpath, directories, files in os.walk("."): for f in files: fpath = dirpath + '/' + f st = os.stat(fpath) mode = st.st_mode & 0o777 print("%o" % mode, fpath)
Copy & paste the script, above, to your system (beware of tabs) and make sure that it runs properly.
Add code to ignore files that begin with a dot, e.g.,
Add code to print the file protection bits in the style
ls -l, e.g.,
You’re concerned about others reading your secret files. Add code to complain, to standard error, for each file that is publicly readable, writable, or executable.
Add code to not complain (see above) if the file
in the same directory as the file that is publicly
Hey, we’re only listing plain files, not directories! Modify your program to also list directories.
Show the modification time for the files.
Show your work to the TA.