Monthly Archives: January 2016

Count all folders recursively

   ls -lR | grep ^d | wc -l

ls -lR gets a long format of all files and directories of a given folder. Every line which contains a directory starts with d as the first character. So grep ^d filters all such lines (^ is for Beginning-Of-Line). wc -l counts the Newline characters in a given file or stdin. Because every line contains a single directory entry and every line ends with a newline character, you will get the number of the directories.

Attached Libraries

Back from the X-mas chaos and stress, I found time to look into the FMX files for attached libraries. Forms uses PL/SQL libraries (*.pll or *.plx) to re-use code between different modules. A Form application loads the libraries from the current working directory or the FORM_PATH. So there must be a reference to the libraries within the FMX files.

Our Form Builder 6 let me chose file-based libraries only, the decompiler will support only such libraries.

I have found a reference to a library name and location in the FMX, which seem to stored together as a little structure. After the both references there is a reference to the next library structure. After the last structure the reference is 0. The start of the chained list is referenced by the FormModule structure.

So I can get the first library and then read/jump till I’ll find a NULL value. Very easy, 6 hours.

fmx-6-libraries