- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using CVF 6.6 to create Windows programs (not QuickWin). I'm looking for a routine to create a text list of the files in a Windows folder. I found nothing in the packaged Fortran interfaces. Has anyone found or written an interface to the procedure that can accomplish this?
Thanks,
Harry
Thanks,
Harry
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GETFILEINFOQQ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The DFLIB routine GETFILEINFOQQ will do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve, this works OK. I skipped over this and other "QQ" functions since the documentation does indicate they are for Windows applications. Apparently this is not the case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume you meant "does not". Yes, I can see where it is confusing there....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A small experiment with recursive search into (sub)subroutines didn't work out completely, but here is the code anyway (miss the time to complete it).
Letus know how to correct the recursion.
DaVinci (Clemens de Leeuw)
--------------------------------------
Code:
! Test recursive TstGetFileInfoQQ to seach into subdirectories: ! Create a small directory structure with several subdirectories ! and one subsubdirectory and a file in each of them. ! Run TstGetFileInfoQQ and point to the* (append wildcard "*"). ! TstGetFileInfoQQ should recursively find each subdir and file. ! It does for the first part, but then returns an "Invalid file or pathname" !============================================================================== Program TstGetFileInfoQQ use dflib character(80) files write (*,'(a,)') ' Enter wildcard of files to view: ' length = GetStrQQ (files) ! read or accept statement call DrvGetFileInfoQQ (files) end !============================================================================== RECURSIVE subroutine DrvGetFileInfoQQ (files) use dflib character(80) files integer(4) handle, length character(5) permit integer(2) iyr, imon, iday, ihr, imin, isec type (FILE$INFO) info ! structure declared in dflib handle = FILE$FIRST ! start handle for GetFileInfoQQ !------------------------------------------------------------------ do while (.true.) length = GetFileInfoQQ (files, info, handle) if (info%name(1:1).eq.'.') cycle ! skip hidden "." and ".." system files ! ---------------------------------------------------------------- if ((handle .eq. FILE$LAST) .or. (handle .eq. FILE$ERROR)) then select case (GETLASTERRORQQ( )) case (ERR$NOMEM) write (*,*) 'Out of memory' case (ERR$NOENT) exit case DEFAULT write (*,*) 'Invalid file or path name' end select endif ! ---------------------------------------------------------------- permit = ' ' if ((info%permit .and. FILE$HIDDEN) .ne. 0) permit(1:1) = 'H' if ((info%permit .and. FILE$SYSTEM) .ne. 0) permit(2:2) = 'S' if ((info%permit .and. FILE$READONLY) .ne. 0) permit(3:3) = 'R' if ((info%permit .and. FILE$ARCHIVE) .ne. 0) permit(4:4) = 'A' if ((info%permit .and. FILE$DIR) .ne. 0) permit(5:5) = 'D' write (*,'(1x,a,i8,3i11,'' '',a)') & permit, info%length, info%creation, info%lastwrite, info%lastaccess, trim(info%name) ! -- Date-time fields are packed, unpack these as follows: ! call UnpackTimeQQ (info%lastwrite, iyr,imon,iday,ihr,imin,isec) ! write (*,'(9x,i5,5i3,/)') iyr,imon,iday,ihr,imin,isec pause ! test ! -- Here TstGetFileInfoQQ should scan recursively into subdirectories: if (permit(5:5).eq.'D') then icount = icount + 1 ! test if (MOD(icount,10)==0) pause ! test type *, '>>>>>', trim(info%name), ' >>>>> ', icount call DrvGetFileInfoQQ (trim(info%name) // '*') endif enddo !-------------------------------------------- ---------------------- end subroutine

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page