1

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?

Conor
  • 736
  • 1
  • 13
  • 33
Thomas
  • 81
  • 4

2 Answers2

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
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