Answered step by step
Verified Expert Solution
Link Copied!

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 modify/extend the First.py script as follows:
1) Allow the user to specify a directory to process using the built-in Python input() function
2) Process each entry in that directory and report:
Full-Filepath, FileSize, MAC Times for each directory entry
Converting each MAC epoch value into human readable form
3) Catch any errors when attempting to process files and report them
HINTS
PROMPT USER FOR ENTRY
directory = input("Enter a Directory to Process: ")
CONVERT EPOCH VALUES TO HUMAN READABLE UTC TIME
Epoch= macTimes[0]
utcTime= time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(modEpoch))
print(utcTime) 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 3RD PARTY LIBRARIES '"'
# NONE
'" DEFINE PSEUDO CONSTANTS '"'
# NONE
'" LOCAL FUNCTIONS '"'
def GetFileMetaData(fileName):
obtain filesystem metadata
from the specified file
specifically, filesize and MAC Times
return True, None, filesize and MacTimeList
try:
metaData = os.stat(fileName) # Use the stat method to obtain meta data
filesize = metaData.st_size # Extract filesize and MAC Times
timeLastAccess = metaData.st_atime
timeLastModified = metaData.st_mtime
timecreated = metaData.st_ctime
macTimeList =[timeLastModified, timeLastAccess, timecreated] # Group the MAC Times in a List
return True, None, filesize, macTimeList
except Exception as err:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

What makes up employee benefits expense?

Answered: 1 week ago