Read the Folder File

tonypangtonypang Member Posts: 101
Hello Master
Now i facing some issue

If i need to read the file from Folder.
How to write the in Navision to read the file.

Example: (my directory C:\Data )
I got 1 folder name as : File and Backup
Inside File folder consist of 3 file : 1.txt,2.txt,3.txt etc
How read the file name from this file one after another

After first file read then need to move it to Backup folder then continues another file.

Can the Navision write this kind of scenario ?


Hope the master here can help me.
Thank you
NAV

Comments

  • kinekine Member Posts: 12,562
    1) Search for File virtual table
    2) Look at RENAME or COPY command in the FILE section of C/AL Symbol menu
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • tonypangtonypang Member Posts: 101
    I still not sure how to do it.
    Do you have sample code ?

    Thanks
    NAV
  • tonypangtonypang Member Posts: 101
    FileTest.OPEN('c:\Data\Test.txt');
    FileTest.CREATEINSTREAM(streamInTest);

    WHILE NOT (streamInTest.EOS()) DO
    BEGIN
    Int:= streamInTest.READTEXT(Txt,100);

    END;
    FileTest.CLOSE();


    Is it the above script just for read the text file right?
    then how to read the file from the folder ?

    Hope the master here can help me.
    Thanks
    NAV
  • kinekine Member Posts: 12,562
    Once again, search this forum for "File" table and how to use it...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Please follow kine's advice: http://lmsmfy.com/?q=file+virtual+table
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • tonypangtonypang Member Posts: 101
    thanks
    NAV
Sign In or Register to comment.