I have been studying ways to digitally archive old paper reports using a
one-sided scanner with an automatic paperfeed. Two options have occurred to
me.

One. Scan to a single PDF file,
Two. Scan to a folder containing multiple PNG files.

The options are very similar except that the PDF mode seems to take
considerably more disk space.

Both methods suffer slightly when the original documents are two-sided
because either the pages are out of order (in the PDF) or the numbering of
the individual files in the folder is out of order.

I would like to implement a routine for the second option that would rename
the multiple PNG files. So I have developed some simple J verbs to create
the indexes of the filenames, but I do not know how to associate those
results with the original files and rename the original files correctly in
the case of two-sided originals.That is where I would like some help
especially in knowing what part of the task can be done in J and what part
is done in unix batch files.

Notice in the "typical" example below of four pages that the pages of the
second side are in the reverse of the correct order and that the very first
page does not have a number associated with it.

server:Documents brian$ ls -l combined\ not
total 872
-rw-r--r--  1 brian  staff   88517 Dec 14 09:13 combined 1.png
-rw-r--r--  1 brian  staff  119690 Dec 14 09:13 combined 2.png
-rw-r--r--  1 brian  staff  129123 Dec 14 09:13 combined 3.png
-rw-r--r--  1 brian  staff  100494 Dec 14 09:13 combined.png
server:Documents brian$ ls -l combined.pdf
-rw-r--r--@ 1 brian  staff  971300 Dec 12 08:22 combined.pdf


Below are the J verbs for creating indexes based on the number of files in
a directory.

nodd=: >.@-:
neven=: <.@-:
odd=: >:@+:@i.@nodd
even=: 2+|.@:+:@i.@neven
zero=: '0'&,@":"0

Note 'some test cases'
<@:even"0] 0 1 2 3 4
<@:odd"0] 0 1 2 3 4
zero odd 4
zero even 3
zero even 0
1&|. zero (odd,even) 4   NB. this would be most like
NB. a production case because it would
NB. match the order of the file list in the original ls
)

Thanks,

---
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to