# How to get the file names

**URL:** <https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069>\
**Category:** User Forum\
**Created:** [April 8, 2010, 10:46am UTC](https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069 "2010-04-08T10:46:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_Marshal](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@J\_Marshal](https://www.dynamicsuser.net/u/J_Marshal)\
**Post date:** [April 8, 2010, 10:46am UTC](https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069/1 "2010-04-08T10:46:34Z")

</div>

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.

Thanks

Jerome Marshal.J

---

<div class="post-metadata">

**Author:** ![DRB](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@DRB](https://www.dynamicsuser.net/u/DRB)\
**Post date:** [April 8, 2010, 10:58am UTC](https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069/2 "2010-04-08T10:58:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lvanvugt](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/lvanvugt/32/7500_2.png) [@lvanvugt](https://www.dynamicsuser.net/u/lvanvugt)\
**Post date:** [April 8, 2010, 11:13am UTC](https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069/3 "2010-04-08T11:13:00Z")

</div>

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

 ![1145.File Table.JPG](https://us1.discourse-cdn.com/flex023/uploads/dugusers/original/2X/4/4e754f5f36df5db8da0e40bfdb23ef143d40e5ba.jpeg)

---

<div class="post-metadata">

**Author:** ![J\_Marshal](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@J\_Marshal](https://www.dynamicsuser.net/u/J_Marshal)\
**Post date:** [April 8, 2010, 11:24am UTC](https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069/4 "2010-04-08T11:24:19Z")

</div>

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 table.in **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

Thanks

Jerome Marshal

---

<div class="post-metadata">

**Author:** ![J\_Marshal](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@J\_Marshal](https://www.dynamicsuser.net/u/J_Marshal)\
**Post date:** [April 8, 2010, 11:32am UTC](https://www.dynamicsuser.net/t/how-to-get-the-file-names/25069/5 "2010-04-08T11:32:30Z")

</div>

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

Jerome Marshal
