Difference between revisions of "Windows Powershell"

From rbachwiki
Jump to navigation Jump to search
(Created page with "<pre> $datecurrent = get-date -Format MM-dd-yyyy $apath = "C:\Users\Robert\Desktop\leaves" $btest = "C:\Users\Robert\Desktop\leaves\pdf-sliced" $ctest = "C:\Users\Robert\Deskt...")
 
Line 1: Line 1:
== Script that create a folder based on today's date, then copy the contents of one folder to another==
<pre>
<pre>
$datecurrent = get-date -Format MM-dd-yyyy
$datecurrent = get-date -Format MM-dd-yyyy

Revision as of 14:36, 31 March 2020

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\Robert\Desktop\leaves"
$btest = "C:\Users\Robert\Desktop\leaves\pdf-sliced"
$ctest = "C:\Users\Robert\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


Category