Assignment 5.1 File System Commands
Assignment 5.1 File System Commands
Introduction
In this lab, you will use CLI commands to manage files and folders in Windows.
Recommended Equipment
A computer running Windows
Instructions
Step 1: Access the Windows command prompt.
a. Log on to a Windows computer. The account ITEUser is used as the example user account throughout
this lab.
b. To access the Windows command prompt, click Start and enter cmd. Select Command Prompt or
cmd.exe to continue.
Step 2: Create and change directories.
In this step, you will use the change directory (cd), make directory (md), and directory (dir) commands.
Note: A directory is another word for folder. Directory and folder are used interchangeably throughout this lab.
a. Type cd at the command prompt.
Question:
What is the current directory?
Type your answers here.
b. Type dir at the command prompt to list the files and folders that are in the current folder.
C:\Users\ITEUser> dir
Volume in drive C has no label.
Volume Serial Number is 9055-35E9
Directory of C:\Users\ITEUser
2015 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 6 www.netacad.com
Lab – File System Commands
c. In the current directory, use the md command to create three new folders: ITEfolder1, ITEfolder2, and
ITEfolder3. Type md ITEfolder1 and press Enter. Create ITEfolder2 and ITEfolder3. (Note: The
command mkdir performs the same function as the command md.)
C:\Users\ITEUser> md ITEfolder1
C:\Users\ITEUser> md ITEfolder2 ITEfolder3
d. Type dir to verify that the folders have been created.
e. Type cd ITEfolder3 at the command prompt and press Enter.
Question:
Which folder are you in now?
Type your answers here.
f. Create ITEfolder4 in the current directory. Within the ITEfolder4 folder, create a folder named
ITEfolder5. Use the dir command to verify the folder creation.
Question:
What command or commands did you use to create the nested folders?
Type your answers here.
g. Change directory as necessary until you are in ITEfolder5.
h. Type cd .. to change the current directory. Each .. is a shortcut to move up one level in the directory tree.
Question:
After issuing the cd .. command, what is your directory now?
Type your answers here.
What would be the current directory if you issue this command at C:\Users\ITEUser\ITEfolder3\
ITEFolder4?
Type your answers here.
Step 3: Create text files.
a. Navigate to the C:\Users\ITEUser\ITEfolder1 directory. Type cd ..\ITEfolder1 at the prompt.
b. Type echo This is doc1.txt > doc1.txt at the command prompt. The echo command is used to display a
message at the command prompt. The > is used to redirect the message from the screen to a file. For
example, in the first line, the message This is doc1.txt is redirected into a new file named doc1.txt. Use
the echo command and > redirect to create these files: doc2.txt, file1.txt, and file2.txt.
C:\Users\ITEUser\ITEfolder1> echo This is doc1.txt > doc1.txt
C:\Users\ITEUser\ITEfolder1> echo This is doc2.txt > doc2.txt
C:\Users\ITEUser\ITEfolder1> echo This is file1.txt > file1.txt
C:\Users\ITEUser\ITEfolder1> echo This is file2.txt > file2.txt
c. Use the dir command to verify the files are in the ITEfolder1 folder.
C:\Users\ITEUser\ITEFolder1> dir
<some output omitted>
04/29/2019 08:05 AM 19 doc1.txt
04/29/2019 08:06 AM 19 doc2.txt
04/29/2019 08:08 AM 20 file1.txt
04/29/2019 08:08 AM 20 file2.txt
4 File(s) 78 bytes
2 Dir(s) 32,625,397,760 bytes free
2015 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 6 www.netacad.com
Lab – File System Commands
d. Use the more or type command to view the content of the newly created text files.
C:\Users\ITEUser\ITEfolder1> more doc1.txt
This is doc1.txt
2015 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 6 www.netacad.com
Lab – File System Commands
k. To view the content of the file doc2_new.txt, use the type or more command at the prompt.
C:\Users\ITEUser\ITEfolder1> type doc2_new.txt
This is doc2.txt
l. Use the ren command to rename doc2_new.txt to doc3.txt. Use the dir command to display the content in
the directory.
c:\Users\ITEUser\ITEfolder1> ren doc2_new.txt file.log
m. Use the type or more command to view the content of the newly rename file file.log.
C:\Users\ITEUser\ITEfolder1> more file.log
This is doc2.txt
n. To delete a file or multiple files, use the del command with the file names at the prompt.
Question:
What single command would you use to delete all the files with doc2 in the filename? Use the command
to remove the files with doc2 in the filename.
Type your answers here.
What command would you use to delete all the files in the directory? Use the command to remove the
files.
Type your answers here.
Step 5: Use the xcopy and robocopy commands.
In this step, the xcopy and robocopy commands are used to copy the content in a directory.
a. View the content of ITEfolder3.
C:\Users\ITEUser\ITEfolder1> dir ..\ITEfolder3
<some output omitted>
Directory of c:\Users\ITEUser\ITEfolder3
2015 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 6 www.netacad.com
Lab – File System Commands
b. Type xcopy ..\ITEfolder3 . at the prompt to copy the content of ITEfolder3 to ITEfolder1. Note the . at
the end of the command. It is a shortcut for the current directory.
C:\Users\ITEUser\ITEfolder1> xcopy ..\ITEfolder3 .
..\ITEfolder3\file1.txt
..\ITEfolder3\file2.txt
2 File(s) copied
c. At the prompt, type dir to display the content of ITEfolder1. Only the files in the ITEfolder3 were copied
into ITEfolder1. The directory ITEfolder4 was not copied into ITEfolder3.
C:\Users\ITEUser\ITEfolder1> dir
<some output omitted>
Directory of C:\Users\ITEUser\ITEfolder1
04/29/2019 03:16 PM <DIR> .
04/29/2019 03:16 PM <DIR> ..
04/29/2019 03:05 PM 20 file1.txt
04/29/2019 03:05 PM 20 file2.txt
2 File(s) 40 bytes
2 Dir(s) 31,491,321,856 bytes free
d. Use help xcopy or xcopy /? to determine which switch would allow the xcopy command to copy all the
files and directories.
Question:
What option allows you to copy all the files and directories, including the empty directories?
Type your answers here.
e. Because ITEfolder4 is a subfolder and ITEfolder5 is both a subfolder and an empty folder, /E is needed
to copy all the contents of ITEfolder3 and the empty subfolder.
Type xcopy /E ..\ITEfolder3 . at the prompt to copy the files. When prompted, type a to allow overwriting
the existing files.
c:\Users\ITEUser\ITEfolder1> xcopy /E ..\ITEfolder3
Overwrite C:\Users\ITEUser\ITEfolder1\file1.txt (Yes/No/All)? a
..\ITEfolder3\file1.txt
..\ITEfolder3\file2.txt
2 File(s) copied
f. Verify that the ITEfolder4 and ITEfolder5 were also copied in ITEfolder1.
c:\Users\ITEUser\ITEfolder1> dir
<some output omitted>
Directory of c:\Users\ITEUser\ITEfolder1
2015 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 5 of 6 www.netacad.com
Lab – File System Commands
g. The robocopy command can also be used to copy the content of a directory to a new destination. The
robocopy command has more capabilities than the built-in Windows copy and xcopy command, such as
resume copying after a network interruption, skip files that appear to be identical to the files in the
destination folders, and mirror a directory by keeping the destination directory in sync with the source
directory.
Copy the ITEfolder4 content to ITEUser folder using the robocopy command.
C:\Users\ITEUser\ITEfolder1> robocopy /E C:\Users\ITEUser\ITEfolder3\
ITEfolder4\ C:\Users\ITEUser
Note the information provided by the command during the copying process.
h. Navigate to C:\Users\ITEUser to verify that the folder ITEfolder5 is copied.
Step 6: Delete directories.
In this step, you will delete an empty and a non-empty directory using the rd command.
a. Use the rd ITEfolder2 to delete the empty directory and verify that the directory was deleted.
C:\Users\ITEUser> rd ITEfolder2
b. Navigate to the C:\Users\ITEUser\ITEfolder3 directory.
c. Use the rd ITEfolder1 to delete the directory. Verify the directory removal using the dir command.
Were you able to delete the directory? Explain.
Type your answers here.
d. Use rd /? command to determine the switch that allows the deletion of a non-empty directory.
c:\Users\ITEUser\ITEfolder3> rd /S ITEfolder1
ITEfolder4, Are you sure (Y/N)? y
e. Use the appropriate commands to delete all the text files and folders that you have created in this lab.
Type exit to close the command prompt window.
Reflection Question
What are the advantages of using CLI vs. GUI?
Type your answers here.
End of Document
2015 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 6 of 6 www.netacad.com