Rename csv file in a folder based on first row value

I am very new to Powershell and would like some help please. I have csv files in a folder and would like to rename each file based on the first row value.

For example

csvFile#1 StudentID,EnglishM,MathsM 900212,90,80

csvFile#2 StudentID,EnglishM,MathsM 900213,92,88

csvFile#2 StudentID,EnglishM,MathsM 900214,97,81

Output csvFile#1: 900212_currentdateTime csvFile#2: 900213_currentdateTime csvFile#3: 900214_currentdateTime

Read more here:

Content Attribution

This content was originally published by viper007 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: