Windows Powershell

From rbachwiki
Revision as of 15:05, 31 March 2020 by Bacchas (talk | contribs)
Jump to navigation Jump to search

Script that create a folder based on today's date, then copy the contents of one folder to another

$datecurrent = get-date -Format MM-dd-yyyy
$apath = "C:\Users\john\Desktop\leaves"
$btest = "C:\Users\john\Desktop\leaves\pdf-sliced"
$ctest = "C:\Users\john\Desktop\leaves\atest"

#create directory
New-Item -ItemType directory -Path "$ctest\$datecurrent"

#open folder
ii "$ctest\$datecurrent"

#copy files
Copy-Item -Path $btest\* -Destination "$ctest\$datecurrent" -Verbose

save with .ps1 extension

CD to a specific directory

set-location 'g:\box\All Flds\web\amazon\test'

Category