Using Clarion 11.1 under Windows 11 I try to build a picture database.
The following code is copied from the documentation and only merely modified:
PicPath = 'C:\Users\Volke\Dropbox\Portrait'
setpath(longpath(PicPath))
DIRECTORY(AllFiles,'*.*',ff_:DIRECTORY) !Get all files and directories
Recs = RECORDS(AllFiles)
LOOP LP = Recs TO 1 BY -1
GET(AllFiles,LP)
IF BAND(FIL:Attrib,ff_:DIRECTORY) AND FIL:ShortName <> '..' AND FIL:ShortName <> '.'
PICTURES:Name = FIL:Name
PICTURES:Filename = longpath(FIL:Name)
get(pictures,0)
if ~duplicate(pictures) then add(pictures).
brw6.ResetSort(1)
brw6.UpdateWindow()
CYCLE !Let sub-directory entries stay
ELSE
DELETE(AllFiles) !Get rid of all other entries
END !IF
END !LOOP
setpath(longpath(ProgramPath))
It only searches in âC:\Users\Volke\Dropbox\Portraitâ but it does not enter the sub-directories.
In the DIRECTORY()-command I also tried ff_:NORMAL and ff_:NORMAL+ff_:DIRECTORY.
Of course I searched Clarion Hub before I asked. But I cannot find any help in the given examples.
DIRECTORY() works so far, except that it doesnât work recursively. I doesnât look into the directories.
It only works in the âtop levelâ.
It seems that browses do not work with âhand codedâ queues.
Also the âdirâ in the AdjustDir-procedure is unknown.
Well. My main problem is still the Directory()-command. It works, but only in the top level directory (as defined in PicPath). But it should work recursively (looking also into the sub directories). Years ago (with Clarion 8) I got it to work but I donât have the application anymore.
Open the solution from my previous message and just build it by pressing F8.
If you want to edit the source file, open the Solution Explorer toolbox, highlight the filename under the project, press right mouse button and choose the Open item in the menu.
In your example I make a double click onto directories. This always triggers a new directory() call. Thatâs not exactly what I want. I want to get every picture file calling directory() only once regardless in which level the picture is to be found. As far as I remember, directory() worked recursively - at least under Clarion 8.
I had written some code somewhere which let me choose what tree traversal methods to use, Iâll see if I can find it later on tonight, I dont think its in a class though, but it might have been some of the code that got wiped from my machine when it got hacked, so if I can find it, Iâll post it.
Edit. Iâve just seen above @CarlBarnes has posted some working code, so that should get you going.
Thank you so much! After watching the Screenshots this is exactly what I looked for. Even more, because the tree would have been my next problem. I will test it next weekend.
I read the Wikipedia article. Then I read it in German. And then I decided that my programming skills are not sufficient at all. Well, itâs only a hobby.
After years of professional photography, I just have a large photo collection now and want to bring it into some order.
I am rather confident that Carlâs example will help.
Here is just another example of Directory usage, very similar to example posted by Also
key points:
-just 60 lines of codes (to highlight built-in Clarion RTL features)
-drill up/down through directories with mouse or keyboard
-resizable window
-code compatible with older versions (tested also in c55) DirBrowser.zip (2,0 KB)