Activity 8.1: Program and Scripts Review
In this activity, you will review two simple scripts, one written in PowerShell and the other in Python. Both scripts list files in a specified directory and display their sizes. You will analyze the structure and functionality of each script and answer questions about their components and expected outputs.
This activity is designed to develop your ability to analyze and interpret basic scripts used for filesystem operations. By working with PowerShell and Python scripts, you will enhance your skills in reading, understanding, and modifying code to fit specific needs. By the end of this activity, you will have learned about listing directory contents, retrieving and formatting file properties, modifying script output, and predicting script behavior in different conditions.
PowerShell Script
$directory = "C:\ExampleDirectory" $files = Get-ChildItem -Path $directory foreach ($file in $files) { $name = $file.Name $size = $file...