Re: Subdirectory
- Posted by alanjohnoxley Jan 14, 2010
- 974 views
The following code is what works for me, it shows each file with its full path, size, and flags:
include win32lib_ajo.ew -- v0.70.4a June 2008 (modified, routine to routine_name) function ShowFilesAndDirs(sequence path_name, sequence ItemEntry) sequence DirMarker, s1, s2, s3, s4, s5, s6 -- Let Windows get a chance. doEvents(0) -- SET A MARKER TO SHOW IN LIST IF FOUND A DIRECTORY: if equal(ItemEntry[D_ATTRIBUTES], "d") then DirMarker = "\\" else DirMarker = "" s1 = ItemEntry end if s1 = sprintf("%04d",{ItemEntry[4]}) -- year s2 = sprintf("%02d",{ItemEntry[5]}) -- month s3 = sprintf("%02d",{ItemEntry[6]}) -- day s4 = sprintf("%012d",{ItemEntry[3]}) -- size, up to 99Gb s6 = ItemEntry[2] -- file flags shrd while length(s6) < 6 do s6 = s6 & " " end while s5 = DirMarker -- suppress <0322> s5 = s6 -- attributes s5 = s5 & " " -- open space for backup flags s5 = s5 & s4 s5 = s5 & " " & s1 & s2 & s3 s5 = s5 & " " & path_name & "\\" s5 = s5 & ItemEntry[1] -- filename puts(allfiles,s5 & "\n") return 0 --Stopped -- keep going (return a non-zero to stop it) end function scanned_flag = walk_dir(drive_letter, routine_id("ShowFilesAndDirs"),1)