1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
-
|
-
|
!
-
|
-
|
!
-
|
|
|
|
|
|
|
|
!
-
|
!
-
|
!
-
|
|
!
-
|
|
!
-
|
|
!
-
|
!
-
|
!
-
|
|
|
|
|
|
|
!
-
|
-
|
!
-
|
!
| #ifdef dirlist2
#define global DL2FULL
#undef dirlist2h
#undef dirlist2
#undef dirlist2r
#endif
#module
#define global dirlist2h(%1=0, %2=0) _dirlist2h %1, %2
#define global dirlist2(%1, %2, %3=0, %4=0) _dirlist2 %1, %2, %3, %4
#define global dirlist2r(%1) _dirlist2r %1
#deffunc _dirlist2h int p1, int p2
if p1 {
PathMode = p1
} else {
PathMode = %10011111
}
if p2 { Separation = strf("%c", p2)
} else {
Separation = ","
}
return 0
#deffunc _serchdir str Target, local List
if SerchSubDir { chdir Target
notesel List
dirlist List, "*", 5
repeat notemax
notesel List
noteget stmp, cnt
_serchdir Target+"\\"+stmp;"
loop
}
chdir Target
dirlist List, FileMask, GetMode
notesel List
Files += notemax
repeat notemax
noteget stmp, cnt
NewLine = ""
if PathMode & %1 { NewLine += Target + "\\" + stmp + Separation;"
}
if PathMode & %10 { NewLine += stmp + Separation
}
if PathMode & %100 { exist stmp
NewLine += str(strsize) + Separation
}
#ifdef DL2FULL
if PathMode & %1000 { fxtget@ TimeStamp, stmp
NewLine += str(TimeStamp(8)) + "/" + str(TimeStamp(9))+ "/" + str(TimeStamp(11)) + Separation
}
if PathMode & %10000 { if (PathMode & %1000) == 0 : fxtget@ TimeStamp, stmp
NewLine += str(TimeStamp(12)) + ":" + str(TimeStamp(13))+ ":" + str(TimeStamp(14)) + Separation
}
#endif
if PathMode & %10000000 { NewLine += Target + Separation
}
if PathMode { poke NewLine, strlen(NewLine) - strlen(Separation), 0
}
if DirSeparation != '\\' { i = 0
repeat
tmp = instr(NewLine, i, "\\");"
if tmp < 0 : break
poke NewLine, tmp + i, DirSeparation
i += tmp + 1
loop
}
Note += NewLine + "\n"
loop
return
#deffunc _dirlist2 var p1, str s, int p2, int p3
#ifdef DL2FULL
dim TimeStamp, 24 #endif
Note = "" StartDir = dir_cur
FileMask = s Files = 0
SerchSubDir = p2 & %1 GetMode = 3 - (p2 & %10)
if p3 { DirSeparation = p3
} else {
DirSeparation = '\\'
}
_serchdir StartDir notesel Note
p1 = strlen(Note)
if Note != "" { poke Note, p1 - 2, 0
}
chdir StartDir
return Files
#deffunc _dirlist2r var v
v = Note
sdim Note, 4
return 0
#global
|