rdk Posted March 4, 2010 Posted March 4, 2010 Hello, I have 900 photos from the photographer that have all been named with the students name and then organised into homeroom folders - all very nice. However, to import photos into our timetable software the photos need to be named with the student codes. Does anyone know how to do a batch rename with something like a "vlookup" to an excel file that would have the names, homerooms and student numbers? I need the utility to look at the current name of the file, find that name in the excel file and rename with the corresponding code. A bit more than the usual batch renaming! I really want to avoid doing this manually. Thanks.
fawkers Posted March 4, 2010 Posted March 4, 2010 Heres a qucik powershell script which should do the job, just change the path to were your files are and run a CSV file from your MIS with the kids names and admissions numbers (student codes), change the path on line 8 to where this csv is. #Get a list of all files in the structure $List = Get-ChildItem -Recurse -Path c:\Windows\system32 #fore each file foreach($item in $list) { #import report containg students names and adminision numbers (collum heading name and adno) import-csv "s:\students.csv" | foreach-object { #check each line in CSV file if it contains the current file name if($item.Name.contains($_.name)) { echo found #rename file to admission number Rename-Item $item $_.adno } } } Hope this helps, 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now