Author Topic: What is a good way of parsing a list of files in a folder?  (Read 3575 times)

0 Members and 1 Guest are viewing this topic.

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
What is a good way of parsing a list of files in a folder?
« on: September 03, 2020, 07:03:28 pm »
Let's say that I have a folder called C:\MyFolder. Inside that folder I have a bunch of files (no sub directories are present).

I want to perform an action on each file in this folder.

What is a good way for me to get a list of all files and then act on them one by one?

Right now I'm doing something that just feels more convoluted than it needs to be.

I'm getting a list of files and redirecting that output to a text file. Then I open the text file and read line by line into a string array to get a list of files.

Is there not some more direct way to populate an array with the names of all the files in a folder?

Marked as best answer by hanness on September 03, 2020, 04:42:32 pm

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
« Last Edit: September 03, 2020, 07:53:37 pm by bplus »

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
Re: What is a good way of parsing a list of files in a folder?
« Reply #2 on: September 03, 2020, 08:42:27 pm »
Thanks! Much appreciated.