Copy 1 file and rename to multiple files from CSV

Hi all,

This may be a simple one ...
I have 1 file that I need to be renamed many times, each renamed file needs to have different filename (The filenames of which I can put into a CSV)

So - C:\Test\File 1 is the file I want to copy to C:\Test\File2, C:\Test\File3 and so on

Thanks!

July 21st, 2015 7:32am

Put list of file names into c:\test\fileslist.txt - just file names and their location - e.g. c:\test\File2

get-content c:\test\fileslist.txt | % { copy c:\test\file1 $_ }

If you will have CSV, you can use import-csv instead of get-content and replace $_ with $_.filename (or a column name)

BTW: Sounds like some homew

Free Windows Admin Tool Kit Click here and download it now
July 21st, 2015 7:42am

Hi all,

This may be a simple one ...
I have 1 file that I need to be renamed many times, each renamed file needs to have different filename (The filenames of which I can put into a CSV)

So - C:\Test\File 1 is the file I want to copy to C:\Test\File2, C:\Test\File3 and so on

Thanks!

Please post your script and any errors you are getting.
July 21st, 2015 7:50am

Hi,

Look at using the range operator and a foreach-object loop.

Free Windows Admin Tool Kit Click here and download it now
July 21st, 2015 7:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics