- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CHARACTER(*),INTENT(IN):: sDir
CHARACTER(*),INTENT(IN):: sFilter
INTERFACE
LOGICAL FUNCTION fnCallback(sFile, lParam)
CHARACTER(*),INTENT(IN):: sFile
!DEC$ATTRIBUTES NO_ARG_CHECK:: lParam
INTEGER:: lParam
END FUNCTION fnCallback
END INTERFACE
LOGICAL, OPTIONAL, INTENT(IN):: bRecursive
!DEC$ATTRIBUTES NO_ARG_CHECK:: lParam
INTEGER, OPTIONAL, INTENT(IN):: lParam
Arguments
sDir
Path of the directory to be searched, without trailing backslash. If empty, the current directory is searched.
sFilter
String that specifies a valid filename to be searched for, which can contain wildcard characters (* and ?).
fnCallback
Callback function of specified prototype. This function is called whenever XEnumFiles finds a file which satisfies given filter. The callback function should return .FALSE. if it wants the enumeration to be continued, or .TRUE. if it wants to stop the enumeration.
[bRecursive]
If present and .TRUE., subdirectories of sDir are searched as well. Otherwise, only sDir is searched for files satisfying given filter.
[lParam]
An arbitrary value defined by the calling application, which XEnumFiles just passes as second argument to fnCallback. If not present, 0 is passed. This parameter is useful if additional communication is needed between the routine which calls XEnumFiles and fnCallback; if lParam is used, there's no need for global variables.
{/quote}
Implementation is in the attached file (make sure you !DEC$DEFINE XLITE at the top of the file & remove read-only attribute). Basically, it's a wrapper around FindFirstFile/FindNextFile/FindClose APIs.
HTH
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Message Edited by JugoslavDujic on 09-07-2004 05:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately our software for network communication with VAX through LAN (WRQ Reflection, which does not support LAN after version 8 now v.12) added some garbage to the beginning and the end of files, and sometimes to the end of lines, even when transferring the files as ASCII, and I dont know why (record length difference?). Therefore we decided to convert all files first and then transfer them.
$ DIR/nohe/notra [MyOldDir]*.*.* /out=FilesList.txt
$ Copy [MyOldDir]*.*.* [MyNewDir]*.*.*
$ PURGE [MyNewDir]*.*
Program CarrCON IMPLICIT NONE Parameter RL = 300 ! Max line length CHARACTER*300 aLine, InFile, OutFile INTEGER I, J, L Open (1, File='FilesList.txt', STATUS='old') READ (1,'(A)', IOSTAT=I) InFile DO WHILE (I.GE.0) ! Skip lines with directory name only, executables, J = INDEX (InFile, '.DIR];') ! object files, etc. repeat If (J .LE. 1) Then ! this for '.EXE];' or '.OBJ];' K = K + 1 ! etc. or delete these lines Goto 200 ! from FilesLis.txt before End If ! running this code. ! Now we have found a file name and path J = INDEX (InFile, ';') - 1 Open (2, File=InFile(:J), STATUS='old', IOSTAT=I) IF (I.NE.0) THEN Write (*,*) ' *** Open Error in file ', InFile, ' no ', I CALL EXIT END IF OutFile = '[MyNewDir.'// InFile(Index(MyOldDir, whatever):J) Open (3, File=OutFile(:J+ path length diff.), STATUS='New', & CarriageControl='LIST', IOSTAT=I) IF (I.NE.0) THEN Write (*,*) ' *** Open Error in file ', OutFile, ' no ', I CALL EXIT END IF DO WHILE (I.GE.0) READ (2,'(A)', IOSTAT=I) aLine IF (I.NE.0) THEN Write (*,*) ' *** Read Error in File ', InFile, ' no ', I Goto 100 ! Take next file END IF L = RL ! Trim the line (There was no 'TRIM' in VAX FORTRAN!) DO WHILE (aLine(L:L).LT.' ' .AND. L.GT.0) L = L - 1 END DO ! Write to the new file WRITE (3, '(A)') aLine(:L) END DO 100 Close(2) Close(3) Write(*,*) OutFile(:J + path length diff.), ' done!' 200 READ (1,'(A)', IOSTAT=I) InFile END DO Close(1) END
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page