I posted this to jobs.perl.org by the way, as well as a Perl newsgroups

You can assume the directory is called DirectoryName, and contains
files of only two types:  .txt files, and .tif files.  The directory
will contain files something like this:

FileName1.txt
FileName1.tif

FileName2.txt
FileName2.tif
FileName3.tif
FileName4.tif

FileName5.txt
FileName5.tif
FileName6.tif
FileName7.tif
FileName8.tif

There is always a .txt file associated with one or more .tif files.   

For example, FileName1.txt is obviously associated with FileName1.tif. 


But there are three .tif files associated with FileName2.txt:
FileName2.tif, FileName3.tif, and FileName4.tif.   

And there are four .tif files associated with FileName5.txt:
FileName5.tif, FileName6.tif, FileName7.tif, and FileName8.tif

The name of a .txt file always corresponds exactly to the name of the
first .tif file associated with it (excepting for the file extension,
of course). 

There can be any number of .tif files associated with a .txt file.  You
can assume the .tif files associated with a .txt file are always
numbered in sequence, starting with the number of the .txt file.   

However, you should assume that the number of .tif files associated
with a .txt file increases with the number of .txt files, as in my
example. The first .txt file might have five .tif files with it, the
second .txt file might have only one .tif file associated with it, and
so on.

The outputted text file should have the following format for the above
group of files:

@FULLTEXT DOC

; Record 1
@C BEGDOC# FileName1
@C ENDDOC# FileName1
@C PGCount 1
@T FileName1
@D @I\DirectoryName\
FileName1.tif

; Record 2
@C BEGDOC# FileName2
@C ENDDOC# FileName4
@C PGCount 3
@T FileName2
@D @I\DirectoryName\
FileName2.tif
FileName3.tif
FileName4.tif

; Record 3
@C BEGDOC# FileName5
@C ENDDOC# FileName8
@C PGCount 4
@T FileName5
@D @I\DirectoryName\
FileName5.tif
FileName6.tif
FileName7.tif
FileName8.tif

You can see that after BEGDOC#, you put the file name corresponding to
the first .tif file that corresponds to a .txt file, and after ENDDOC#,
you put the name of the last .tif file corresponding to that .txt file. 
After PGCount, you put the number of .tif files that correspond to that
.txt file.  After @T, you put the name of the .txt file (minus the
extension).  And then below the @D file, you list all the .tif files
that correspond to that .txt file.

There can be any number of .txt files, sometimes quite large, and any
(nonzero) number of .tif files associated with each .txt file.

The outputted text file should be called  DirectoryName.dii  where
DirectoryName is the name of the directory holding the files, as
above.

That's it.  

I have a large number of directories to process in this manner, so if
you want to build a script that automatically searches for
subdirectories containing files like this, and creates a .dii file for
each such subdirectory, that'd be even better.


-- 
Mike Anderson

'FREE RADICAL 
RADIO!' (http://nvo.com/cd)  Hours of free radical MP3s.
------------------------------------------------------------------------
Mike Anderson's Profile: http://forums.slimdevices.com/member.php?userid=1705
View this thread: http://forums.slimdevices.com/showthread.php?t=20753

_______________________________________________
Discuss mailing list
Discuss@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to