Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ASSIGNMENT DETAILS After experimenting with the First.py script and attending this weeks lecture, you are to modify / extend the First.py script as follows: 1
ASSIGNMENT DETAILS
After experimenting with the First.py script and attending this weeks lecture, you are to modifyextend the First.py script as follows:
Allow the user to specify a directory to process using the builtin Python input function
Process each entry in that directory and report:
FullFilepath, FileSize, MAC Times for each directory entry
Converting each MAC epoch value into human readable form
Catch any errors when attempting to process files and report them
HINTS
PROMPT USER FOR ENTRY
directory inputEnter a Directory to Process:
CONVERT EPOCH VALUES TO HUMAN READABLE UTC TIME
Epoch macTimes
utcTime time.strftimeYmd H:M:S time.gmtimemodEpoch
printutcTime The following pics are the started code IMPORT STANDARD LIBRARIES
import os # File System Methods
import sys # System Methods
import time # Time Conversion Methods
IMPORT RD PARTY LIBRARIES
# NONE
DEFINE PSEUDO CONSTANTS
# NONE
LOCAL FUNCTIONS
def GetFileMetaDatafileName:
obtain filesystem metadata
from the specified file
specifically, filesize and MAC Times
return True, None, filesize and MacTimeList
try:
metaData osstatfileName # Use the stat method to obtain meta data
filesize metaData.stsize # Extract filesize and MAC Times
timeLastAccess metaData.statime
timeLastModified metaData.stmtime
timecreated metaData.stctime
macTimeList timeLastModified timeLastAccess, timecreated # Group the MAC Times in a List
return True, None, filesize, macTimeList
except Exception as err:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started