I multiple files in a folder that needs to be processed. For that I used the List Files > Table Row to Variable Loop Start > CSV Reader nodes to process one file at a time.
The List Files node doesn't seems to read the files in its sequence. It is important to me to maintain the sequence order of the files as it is in the folder.
Can I know why is the List Files not maintaining the order list as it reads from the folder? How can I maintain the order of the files?
There is no such things as a canonical order of files in a folder. Well maybe there is, but it depends on the internal structure of the file system and is usually not sorted by any obvious attribute of the files. Usually when you list the files they are explicitly sorted by name or date, for example. I guess you want to have them sorted by creation/modification date? You may be able to achieve this by determining the file attributes and sorting by date with a few nodes after the List Files.
Thank you for your reply.
I'm not trying to canonicalize the order of my files in folder as the List Files reads it. I just want the List File to maintain the order of the files as it is when I opened it in the Windows.
For example, when I opened the folder in Windows, my files are listed as:
However, the List Files node reads it as:
As noticed, not only the csv files are in original order but the order of the folder also has changed. Modification of the sorting based on date is not an option for me as all the files were created on the same date (base ob previous process).
As I said, the Windows Explorer (or whatever program you are using) sorts the files by some attribute of the file, which is one of many possibilities. If you find out how exactly you want them sorted, it should be possible to do this in the workflow after the List Files node.
Ok I got it. Thanks for your replies.
Is there a companion node to List Files/Folder which includes other descriptors the file system keep like date created, date modified, Type, Size… to name a few. These are handy for filtering down or sequence the files you want in a “messy” folder you don’t control.
have a look at this node: