How to use Channel.fromPath read the content from a file? #3963
Unanswered
DescartesM
asked this question in
Q&A
Replies: 2 comments
-
How about this: Channel.fromPath('/some/path/*.{txt,csv,yml}') |
Beta Was this translation helpful? Give feedback.
0 replies
-
I encountered a similar problem where I needed to read a list of files from a file instead of using I/O-heavy filesystem globbing on a directory with numerous files. In addition, the input channel needed to be divided into pairs and sent as a list of file paths to a process. Using splitText() alone wouldn't suffice, as it adds a newline to each element. However, the combination of splitCsv() and map{} did the trick:
the result, in case of 3 files:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The scene is a bit special. I have a series of files in the same directory, but I don't know the number of files before and the file suffixes are not uniform;
My goal is to achieve a grouping effect like this
But due to the different names and suffixes, I can not use the fromPath('/some/path/*.txt')......
So currently, I have implemented similar capabilities using shell scripts. I write these file names into a file, and use Channel.fromPath to read it.
However, I get the error message as following.
I would like to know how to solve the above problem or if there are any other ways to achieve my goal, thx.
Beta Was this translation helpful? Give feedback.
All reactions