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

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2