Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
Write a complete program that prints out the list of files in the current directory,
along with their file sizes and last modified datetime stamps. Any sub-directories are
ignored. At the end, print the total file size.
It accepts two optional command-line arguments:
Sort field (single sort key
only)
“name" for filename,
"size" for file size,
1
"date" for last modified
datetime stamp,
default is “name".
"asc" for ascending,
"desc" for descending,
2
Sort order
default is “asc".
A sample execution of the program with both command line arguments provided is
shown below.
$ python q3a.py date desc
Filename
Size
Last Modified
fileSorter.py / 1461 / Sat Jan 30 01:40:48 2021
optimized_fib.py / 273 / Fri Jan 29 10:53:45 2021
tic-tac-toe-bot-master.zip / 37180 / Thu Jan 28 15:12:03 2021
tictactoe.py / 8157 / Thu Jan 28 14:59:45 2021
getComputerMove.py / 1131 / Thu Jan 28 14:55:22 2021
Total file size: 48203
Research how you access the file system using the functions in the os module. You
may use Python’s built-in sort() function to perform the sort.
expand button
Transcribed Image Text:Write a complete program that prints out the list of files in the current directory, along with their file sizes and last modified datetime stamps. Any sub-directories are ignored. At the end, print the total file size. It accepts two optional command-line arguments: Sort field (single sort key only) “name" for filename, "size" for file size, 1 "date" for last modified datetime stamp, default is “name". "asc" for ascending, "desc" for descending, 2 Sort order default is “asc". A sample execution of the program with both command line arguments provided is shown below. $ python q3a.py date desc Filename Size Last Modified fileSorter.py / 1461 / Sat Jan 30 01:40:48 2021 optimized_fib.py / 273 / Fri Jan 29 10:53:45 2021 tic-tac-toe-bot-master.zip / 37180 / Thu Jan 28 15:12:03 2021 tictactoe.py / 8157 / Thu Jan 28 14:59:45 2021 getComputerMove.py / 1131 / Thu Jan 28 14:55:22 2021 Total file size: 48203 Research how you access the file system using the functions in the os module. You may use Python’s built-in sort() function to perform the sort.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education