powershell - Poweshell get file with last date included -
i have saved file :
get-childitem -path $ospathtemp | rename-item -newname { $_.basename + '_' + $_.lastwritetime.tostring('ddmmyyyy') + $_.extension }
how can select file again ? tried :
$path = "\\srvsccm01\_source$\os\refws2016" + '_' + { $_.lastwritetime } + $_.extension
the file named: refws2016_xxxxx.wim
simple enough... add -passthru
rename-item
, save result in variable.
$file = get-childitem -path $ospathtemp | rename-item -newname { $_.basename + '_' + $_.lastwritetime.tostring('ddmmyyyy') + $_.extension } -passthru
then reference $file
.
Comments
Post a Comment