+ Post New Thread
Results 1 to 3 of 3
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 ...
  1. #1
    rdk
    rdk is offline

    Join Date
    Sep 2008
    Posts
    125
    Thank Post
    2
    Thanked 15 Times in 14 Posts
    Rep Power
    31

    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.

  2. #2
    fawkers's Avatar
    Join Date
    Jun 2007
    Location
    Southend
    Posts
    193
    Thank Post
    32
    Thanked 22 Times in 21 Posts
    Blog Entries
    2
    Rep Power
    31
    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,

  3. Thanks to fawkers from:

    bossman (5th March 2010)

  4. #3
    rdk
    rdk is offline

    Join Date
    Sep 2008
    Posts
    125
    Thank Post
    2
    Thanked 15 Times in 14 Posts
    Rep Power
    31
    Thanks - I'll try that next week.

SHARE:
+ Post New Thread

Similar Threads

  1. Rename a DC
    By duxbuz in forum How do you do....it?
    Replies: 13
    Last Post: 13th March 2010, 07:52 PM
  2. Rename a batch of files all at once.
    By Kyle in forum How do you do....it?
    Replies: 10
    Last Post: 19th November 2009, 06:31 AM
  3. Rename a PC from a batch file - Any ideas?
    By MrLudwig in forum Windows
    Replies: 13
    Last Post: 8th December 2007, 02:40 AM
  4. 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
  •