Moving Files and Directories

The Move-Item cmdlet moves an item, including its properties, contents, and child items, from one location to another. It can also move a file or subdirectory from one directory to another location.

The following command moves a specific backup file from one location to another:

Move-Item -Path \\fs\Shared\Backups\1.bak -Destination \\fs2\Backups\archive\1.bak

This script moves the entire Backups folder and its content to another location:

Move-Item -Path \\fs\Shared\Backups -Destination \\fs2\Backups\archive

The Backups directory and all its files and subfolders will then appear in the archive directory.