cancel
Showing results for 
Search instead for 
Did you mean: 

DirList

02-25-2014 9:40 AM
591 views 4 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

Just wondering how Dirlist sorts its files retrieved ?

It seems to me that Dirlist (when reading a folder containing hundreds of files)  randomly sorts its files or is there any kind of logic to be found in its sorting process ?

Second : to be able to process the files of a folder based on their creation date and time (oldest files first), i guess i need to use a datawindow and some api calls (findfirstfile etc.) ? I remember someone posted an example of this a while back ... Anybody still have this link please ?

TIA

John

0 Likes

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Likes

The sort order would be by name if you have Sorted property set to true.

For dated sort go with TopWiz

Former Member
0 Likes

I have an example with many of the file Win API functions.

Topwiz Software - Filesys

Former Member
0 Likes

Hi,

you can use these APIs to browse a folder :

FUNCTION ulong FindFirstFile(ref string lpszSearchFile, ref WIN32_FIND_DATA lpffd)  LIBRARY "kernel32.dll" ALIAS FOR "FindFirstFileW"

FUNCTION boolean FindNextFile(ulong hfindfile, ref WIN32_FIND_DATA lpffd)  LIBRARY "kernel32.dll" ALIAS FOR "FindNextFileW"

structure str_filetime :

global type str_filetime from structure

ulong  ul_LowDateTime

ulong  ul_HighDateTime

end type

and structure  WIN32_FIND_DATA :

global type win32_find_data from structure

unsignedlong  dwfileattributes

str_filetime  ftcreationtime

str_filetime  ftlastaccesstime

str_filetime  ftlastwritetime

unsignedlong  nfilesizehigh

unsignedlong  nfilesizelow

unsignedlong  dwreserved0

unsignedlong  dwreserved1

character  filename[260]

character  altfilename[14]

end type

Regards.

Abdallah.

Former Member
0 Likes

There is a solution in PFC (see PFC - Home) in the file service. The function of_dirlist in pfc_n_cst_filesrvunicode contains all you need to get the files with its properties (e.g. creation time). In of_sortdirlist of pfc_n_cst_filesrv you can find a solution for sorting the files using a datawindow.