How to get the file names

Hi Forum

I have folder in my system [name is Marshal] at following location c:\Marshal.Inside the folder [Marshal] i have 4 files[File1,File2,File3,File4].is it possible to get the name of the files by CAL code if so how to do this.


Jerome Marshal.J

You can use OpenFile function of Codeunit 412 (Common Dialogue Management) for this. For example:

Attachment2:= CommonDialogMgt.OpenFile(‘Attachment’,FileName,2,’’,0);

above code will have the File Name in Attachment2 variable.

Edit: This will not meet your requirement exactly to find about the name of all files in a folder, but if you want to store/ save the name of a file using common dialogue management then above will do that.

I think you want to use the virtual table File. This table will be empty initially, but as soon as you set a filter on the Path field - for example c:\ - the table shows all files and directories in this directory.

To have a quick look you can create a form on the File table and apply a filter (see screen shot).

Hi Dhan Raj

Thanks for your quick reply.My exact requirment is a folder will have lot of text files i have to import it into a custom single click all the files have to imported into the custom table.the user should not select any file to import every thing should be automatic.How to do this


Jerome Marshal

Thanks Luc Thanks for your help this is wat i need exactly

Jerome Marshal