I’ve been finishing up a project that requires a MARC record to be copied into 2 different locations and renamed based on directory names.
This script was written and tested on Windows 7 in Cygwin using the BASH Shell.
I’m currently sitting in front of one of our Windows 10 computers that does not have Cygwin or Git BASH installed so there’s no way for me to quickly rename TIFF files from command-line like I am used to . . . enter Windows PowerShell!
I need to rename the files according to the formula <filename_stub>_<###>.tif such that a file like SMDR_1950s-SF-37_May-17-2017_12-51-19.tif becomes SMDR_1950s-37_001.tif. In this case, the <filename_stub> is SMDR_1950s-37 and <###> is 001.
So I wrote a little Windows PowerShell script to help out.