Created
February 2, 2017 19:19
-
-
Save jesselawson/9d90b0b0819d7ca924a3d885fb14f7c5 to your computer and use it in GitHub Desktop.
We worked with a 3rd party vendor (ViaTRON) to scan a bunch of images. They created a text file with identifying information that included the location of the associated images, in incremental, integer form. This script was used to pull out the relevant fields and then stage the files to be uploaded to ImageNow.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file will read through the index files (*.txt) and | |
# copy/rename the files appropriately so that they're ready for upload to ImageNow | |
# Example index file: | |
# "SID","LAST NAME","FIRST NAME","DOB","DOCTYPE","IMAGE" | |
# "234234","Lastname","Firstname","1/15/1986","STUDENT APPLICATION","E:\APPLICATIONS\1.TIF" | |
# "345345","Johnson","Bob","8/25/1986","GRADE WAIVER","E:\APPLICATIONS\2.TIF" | |
# "456456","Doe","Jane","1/15/1986","STUDENT APPLICATION","E:\APPLICATIONS\3.TIF" | |
# Note that the index file is in CSV form. | |
# Applications file | |
# NAMES: SID, LAST NAME, FIRST NAME, DOB, DOCTYPE, IMAGE | |
$i = 0 | |
Import-Csv "C:\ViaTRON Backup\APPLICATION INDEXES.txt" | ForEach-Object { | |
# Generate the appropriate variables for the new filename | |
$StudentID = $_.("SID") | |
$FullName = $_.("LAST NAME")+", "+$_.("FIRST NAME") | |
$DOB = $_.("DOB").Replace("/", "_") # Format the dates according to ImageNow | |
$DocType = "SAH APPLICATIONS"#$_.("DOCTYPE") | |
$ScanDate = "6_15_2016" | |
$ScanUser = "ViaTRON" | |
$AcademicYear = "" | |
$OldFile = $_.("IMAGE").Replace("E:\", "C:\ViaTRON Backup\") | |
# Build the new filename | |
$StagedFilename = "C:\ViaTRON Backup\Staged\"+$studentID+"^"+$FullName+"^"+$DOB+"^"+$DocType+"^"+$ScanDate+"^"+$ScanUser+"^"+$AcademicYear+".tif" | |
write-host "Copying file #$i..." -NoNewline | |
copy-item -Path $OldFile -Destination $StagedFilename | |
write-host "Done!" | |
$i=$i+1 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment