0
0
PowerShellscripting~5 mins

Copy-Item and Move-Item in PowerShell - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the PowerShell cmdlet <code>Copy-Item</code> do?
It copies files or folders from one location to another, similar to copying a file on your computer.
Click to reveal answer
beginner
What is the difference between Copy-Item and Move-Item?
Copy-Item duplicates the file or folder, leaving the original intact. Move-Item transfers the file or folder to a new location and removes it from the original place.
Click to reveal answer
beginner
How do you copy a file named report.txt from C:\Docs to D:\Backup using PowerShell?
Use the command: <br>Copy-Item -Path 'C:\Docs\report.txt' -Destination 'D:\Backup'
Click to reveal answer
intermediate
What happens if you use Move-Item to move a file to a folder that already has a file with the same name?
PowerShell will overwrite the existing file without warning, replacing it with the moved file.
Click to reveal answer
intermediate
How can you copy all files from one folder to another, including subfolders, using Copy-Item?
Use the -Recurse parameter: <br>Copy-Item -Path 'C:\SourceFolder\*' -Destination 'D:\TargetFolder' -Recurse
Click to reveal answer
What parameter do you use with Copy-Item to include all subfolders?
A-Recurse
B-IncludeSubfolders
C-All
D-Subdirs
Which cmdlet would you use to move a file instead of copying it?
AMove-Item
BCopy-Item
CRename-Item
DRemove-Item
If you want to copy a file but keep the original, which cmdlet should you use?
AMove-Item
BRemove-Item
CCopy-Item
DRename-Item
What happens if you move a file to a location where a file with the same name exists?
APowerShell asks for confirmation
BThe existing file is overwritten
CThe move fails with an error
DThe file is renamed automatically
How do you specify the source file in Copy-Item?
A-Source
B-File
C-From
D-Path
Explain how to copy a folder and all its contents to a new location using PowerShell.
Think about copying everything inside the folder, not just the folder itself.
You got /4 concepts.
    Describe the difference between copying and moving files in PowerShell and when you might use each.
    Consider what happens to the original file in each case.
    You got /4 concepts.