[Classiccity-pm] Processing, renaming files

Linda Dubes Law lindadl at uga.edu
Thu Mar 30 05:30:02 PST 2006


Hello, 

I am considering a perl script to process scanned documents.  I have a bunch of the same type of document with each ideally having a unique number that matches a particular pattern.  There may be some duplicates that need to be kept track of.  As the documents are scanned, they will be assigned generic names by the software that comes with the scanner.  

So, at the end of the day, after a certain number of documents have been scanned in, a script runs that will grab the unique number out of the file and rename that file the unique number.  

If the filename already exists, the process goes to a recursive function that adds an 'a' at the end of the file name then checks to see if the 'a' file exists.  If the 'a' file exists then a 'b' gets added to then end of the file name rather than an 'a'. And so on and so on.

I am wondering if there is some grand perl module out there that I should look at or if anyone has a suggestion or opinion about what I am trying to do.  Right now, the plan is to scan the documents into pdf.

Thanks, 

Linda Law 

My pseudo code that I so diligently learned in school goes:

*****************
ls /directory/ > filenames.txt

open filenames.txt

while filenames.txt

	$filename = stdin

	$newfilename = grep /pattern/ $filename

	mv $filename $newfilename

	(recursive function to check and assign new filename if $newfilename exists)
********************
	



More information about the Classiccity-pm mailing list