Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26750 Discussions

GETFILEINFOQQ files and/or directories?

Scott_L_
New Contributor I
151 Views

On Windows, Does GETFILEINFOQQ with wildcard string return files only or files and directories?   If only files, is there a way to list directories with wild card matching?   

It seems DELFILESQQ may delete directories or not depending on the file system.  It seems to delete directories on a local disk but not on a network disk (Linux with SAMBA).  Or it may depend on something else.

thanks

scott

 

0 Kudos
3 Replies
Steve_Lionel
Black Belt Retired Employee
151 Views

As the documentation says, it will return directories - the FILE$INFO structure will have the FILE$DIR bit set.

I have read earlier that deleting files on network shares can be problematic. You may want to see if the Windows API routine DeleteFile works better for you.

Scott_L_
New Contributor I
151 Views

It seems like in initial testing, that GETFILEINFOQQ  with wild card input string does not seem to capture directories.

 

I have directories   junk   and jun11  and I try to get the files matching junk*.

The purpose is to recursively delete directories (could be wildcard syntax)  in Fortran.

On Windows 7;  using intel fortran 17.1.   I am also trying to get our code working on both Windows and Linux, both 17.1.

 

Some retirement Steve...

 

 

 

Steve_Lionel
Black Belt Retired Employee
151 Views

I took the documentation's example for GETFILEINFOQQ, built it and ran it, specifying a folder I had created with two subfolders and two files. Note that I used * as the wildcard and not *.*, which would exclude directories. The only change I made was to use A20 for the file name output format. Here's what I got:

 Enter wildcard of files to view: E:\Temp\*
 .                           0      D
 ..                          0      D
 File1.txt                   0     A
 File2.rtf                   7     A
 Folder1                     0      D
 Folder2                     0      D
Press any key to continue . . .

As you can see, it found the subdirectories as well as the hidden . and .. directories described in the documentation.

Reply