none
In Small Basic, is there a way to read a file name in a specific dir and store it in a variable? RRS feed

  • Question

  • I want to look into a directory, list the filenames and store them (without the path) in variables.

    I could not find any way, so far.

    Thank you for the help.


    • Edited by RedFranz Thursday, September 12, 2013 12:03 PM
    Thursday, September 12, 2013 10:38 AM

Answers

  • Try this:

    D=Program.Directory
    LenD=Text.GetLength(D)+2
    Fls=File.GetFiles(D)
    For i=1 To Array.GetItemCount(Fls)
      TextWindow.WriteLine(Text.GetSubTextToEnd(Fls[i],LenD))
    EndFor
      


    Jan [ WhTurner ] The Netherlands

    • Proposed as answer by litdevModerator Thursday, September 12, 2013 6:31 PM
    • Marked as answer by RedFranz Tuesday, September 17, 2013 9:50 AM
    Thursday, September 12, 2013 11:31 AM
    Answerer

All replies

  • Try this:

    D=Program.Directory
    LenD=Text.GetLength(D)+2
    Fls=File.GetFiles(D)
    For i=1 To Array.GetItemCount(Fls)
      TextWindow.WriteLine(Text.GetSubTextToEnd(Fls[i],LenD))
    EndFor
      


    Jan [ WhTurner ] The Netherlands

    • Proposed as answer by litdevModerator Thursday, September 12, 2013 6:31 PM
    • Marked as answer by RedFranz Tuesday, September 17, 2013 9:50 AM
    Thursday, September 12, 2013 11:31 AM
    Answerer
  • Thank you Jan, it does exactly what I want!

    Tuesday, September 17, 2013 9:51 AM