windows - Batch rename w/ Powershell - needs to look up and match file_id with title in csv -


i know batch renaming possible via powershell, far didn't find answer solves problem:

i have staple of pdfs named id:

eg.  332906.pdf 331339.pdf 343807.pdf ... 

i produced simple csv out of spreadsheet contains id in first column , corresponding filename want in second one:

appid;fullname i.d. 332906;mike miller_332906; 331339;tom hanks_331339; 343807;scarlett jo_343807; 

.... ....

i have on office computer can't download additional programms or use programming lanugages, have cmd box , powershell.

can that?

thank help!

edit: spreadsheet changed csv; csv example added

you may have problem column heading as-is, if change below:

appid,fullname_id 332906,mike miller_332906, 331339,tom hanks_331339, 343807,scarlett jo_343807, 

you can run simple script file rename:

$c = import-csv .\path\to.csv $c | % { mv "$($_.appid).pdf" "$($_.fullname_id).pdf" } 

what create powershell object containing data csv file.

$c | % { .. } means iterate on rows in csv , run code in blocks {...}

$_ represents each row, , can access columns using .appid , .fullname_id. move (mv) command use rename.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -