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

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -