I have some folder on my desktop, let's call it FOLDER_X. I want to read all the names of files which are in the FOLDER_X. Is it possible to do it with G1ANT, how can I do that?
Asked
Active
Viewed 252 times
2 Answers
1
You can do it also with usage of snippets, i.e. C#:
♥files = ⟦list⟧⊂System.IO.Directory.GetFiles("your path here")⊃
foreach ♥file in ♥files
dialog ♥file
end
If you want to remove the path from ♥file place this line at the beginning of the loop:
text.replace regex ‴^.*\\‴ text ♥file replace ‴‴ result ♥file

Łukasƨ Fronczyk
- 452
- 3
- 8
-
whats up with the ♥s? is this shorthand for something? – Kakoritz Nov 22 '19 at 15:09
-
1Heart sign is used to mark that a name is a variable. Ctrl+4 in G1ANT Studio. – Łukasƨ Fronczyk Nov 27 '19 at 09:34
0
The below script will display all names of files that are in the FOLDER_X.
The directory
command will retrieve all the directories and files that are in the specified path and create the ♥result
variable containing all the data in a list.
The foreach
loop will iterate through the found elements which are of G1ANT path structure. There are several indexes that you can use, for example isfile
and name
that are useful here.
directory path ‴♥environment⟦USERPROFILE⟧\Desktop\FOLDER_X‴
foreach ♥element in ♥result
dialog ♥element⟦name⟧ if ⊂♥element⟦isfile⟧⊃
end foreach

Wiktoria Prusik
- 840
- 4
- 15