- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Copy Folder
Cmdlet
Copy-Item cmdlet is used to copy a directory by passing the path of the directory to be copied and destination path where the folder is to be copied.
Example 1
In this example, we'll copy a folder D:\Temp\Test Folder as D:\Temp\Test Folder1
Type the following command in PowerShell ISE Console
Copy-Item 'D:\temp\Test Folder' 'D:\temp\Test Folder1'
You can see the Test Folder1 in Windows Explorer created.
Example 2
In this example, we'll copy a folder recursively D:\Temp\Test Folder to D:\Temp\Test Folder1
Type the following command in PowerShell ISE Console
Copy-Item 'D:\temp\Test Folder' -Destination 'D:\temp\Test Folder1'
You can see the content of Test Folder1 in Windows Explorer where it contains both the Test Folder and test file.
powershell_files_folders.htm
Advertisements