Requirement is once data processing is over rename the files to the creation date of the file and move it to archive folder
The below two commands are working
Get-ChildItem*OrderData.csv | Rename-Item-NewName {$_.Name.Replace(‘.csv’, (Get-Date$_.CreationTime-format'_yyyy_MM_dd')+‘.csv’)}
Get-ChildItem*OrderData.csv | Move-Item-Destination c:\Data\Archive\
but when I combine them as below then it does not work.
Get-ChildItem*OrderData.csv | Rename-Item-NewName {$_.Name.Replace(‘.csv’, (Get-Date$_.CreationTime-format'_yyyy_MM_dd')+‘.csv’)} | Move-Item-Destination c:\Data\Archive\
Is this possible to achive in PSVer.2
The below two commands are working
Get-ChildItem*OrderData.csv | Rename-Item-NewName {$_.Name.Replace(‘.csv’, (Get-Date$_.CreationTime-format'_yyyy_MM_dd')+‘.csv’)}
Get-ChildItem*OrderData.csv | Move-Item-Destination c:\Data\Archive\
but when I combine them as below then it does not work.
Get-ChildItem*OrderData.csv | Rename-Item-NewName {$_.Name.Replace(‘.csv’, (Get-Date$_.CreationTime-format'_yyyy_MM_dd')+‘.csv’)} | Move-Item-Destination c:\Data\Archive\
Is this possible to achive in PSVer.2