Windows Thread, Batch rename from database in Technical; Hello,
I have 900 photos from the photographer that have all been named with the students name and then organised ...
-
4th March 2010, 04:51 AM #1 Batch rename from database
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.
-
-
IDG Tech News
-
4th March 2010, 08:23 AM #2 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.
Code:
#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,
-
-
5th March 2010, 12:04 PM #3 Thanks - I'll try that next week.
-
SHARE: 
Similar Threads
-
By duxbuz in forum How do you do....it?
Replies: 13
Last Post: 13th March 2010, 07:52 PM
-
By Kyle in forum How do you do....it?
Replies: 10
Last Post: 19th November 2009, 06:31 AM
-
By MrLudwig in forum Windows
Replies: 13
Last Post: 8th December 2007, 02:40 AM
-
By sidewinder in forum Windows
Replies: 4
Last Post: 28th February 2007, 09:37 AM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules