Copy and rename files using a CSV with Powershell


completely new , trying run simple script take source file , copy\rename new location.

sample csv:

orginalfilename,newfilename
g:\academy\client images\374.jpg,e:\images_renamed\t00002us01_374.jpg
g:\academy\client images\374-1.jpg,e:\images_renamed\t00002us02_374-1.jpg

script:

import-csv e:\scripts\copyimg.csv -delimter "," | % { copy-item -path $_.orginalfilename -destination "e:\images_renamed\$($_.newfilename)

error:

copy-item : given path's format not supported.
@ line:1 char:54

any point me in correct direction help. thanks!

ugh, figured out! care, following worked.

import-csv e:\scripts\copyimg.csv | % { copy-item -path $_.orginalfilename -destination "$($_.newfilename)" } 



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

difference between wuauclt1.exe and wuauclt.exe

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL