Question: 1. You will be using the CPT180Stuff folder from the Bash Assignment for this assignment. 2. Create a PowerShell program named workWithFiles4.ps1 3. Add three

1. You will be using the CPT180Stuff folder from the Bash Assignment for this assignment.

2. Create a PowerShell program named workWithFiles4.ps1

3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description c. Programmer's Name (You)

4. Write code that will do the following:

a. Using an if statement, determine if both the dognames.txt file and the catnames.txt file exist. If both files exist, the program should complete steps b h below. If either file does not exist, the program should print out the message "Unable to access one or more files".

b. Get the contents of the file named dognames.txt in the CPT180Stuff\pets\dogs folder.

c. Print the contents of the file.

d. Get the contents of the file named catnames.txt in the CPT180Stuff\pets\cats folder.

e. Print the contents of the file.

f. Add two cat names to the catnames.txt file. You can pick the names. The example output below shows the names Sammy and Luna added.

g. Get the contents of the file named catnames.txt.

h. Print the contents of the file.

5. Submit the workWithFiles4.ps1 file into the PowerShell Assignment Submission Folder.

Hints 1. The PowerShell Add-Content command adds a newline by default.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!