You can call this script from PowerShell with e.g. filecopy.ps1 copy_source copy_destination.

If copy_destination doesn’t exist, the script creates it.

param (
    [string]$copy_source,
    [string]$copy_destination
)

if ( -not ( test-path "$copy_destination" ) ) {
    new-item -type dir -path "$copy_destination" -force | out-null
}

foreach ( $thing in ( get-childitem "$copy_source*" ).name )
{
    write-host $thing " -> " $copy_destination\$thing
    copy-item "$thing" -destination "$copy_destination\$thing" -recurse
}
Advertisements