# How to process a list of files, while knowing the file I"m processing?

**URL:** https://community.seqera.io/t/how-to-process-a-list-of-files-while-knowing-the-file-i-m-processing/735
**Category:** Ask for help
**Tags:** nextflow
**Created:** [May 5, 2024, 8:00pm UTC](https://community.seqera.io/t/how-to-process-a-list-of-files-while-knowing-the-file-i-m-processing/735 "2024-05-05T20:00:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yfarjoun](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/yfarjoun/32/380_2.png) [@yfarjoun](https://community.seqera.io/u/yfarjoun)
#### Post date: [May 5, 2024, 8:00pm UTC](https://community.seqera.io/t/how-to-process-a-list-of-files-while-knowing-the-file-i-m-processing/735/1 "2024-05-05T20:00:57Z")

</div>

I’m trying to process a list of csv’s but have in hand the name of the file that the row came from.

I tried this (but it didn’t work):

```auto
workflow {
    ch_bed=Channel.from(file("${projectDir}/*.bed"))
    ch_bed.map{ it->Channel.fromPath(it).splitCsv(sep:"\t").collect()}.view()
}

```

I know that I can use `fromPath()` instead of `from()` but then I “lose” the name of the file, and I want it for the purposes of the pipeline.

Any pointers are very much appreciated!!

---

<div class="post-metadata">

### Author: ![yfarjoun](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/yfarjoun/32/380_2.png) [@yfarjoun](https://community.seqera.io/u/yfarjoun)
#### Post date: [May 5, 2024, 8:22pm UTC](https://community.seqera.io/t/how-to-process-a-list-of-files-while-knowing-the-file-i-m-processing/735/2 "2024-05-05T20:22:43Z")

</div>

I think I solved this:

```auto
workflow {
    ch_bed=Channel.fromPath(file("${projectDir}/*.bed"))
    .map{it->[it, it.splitCsv(sep:"\t")}
    ch_bed.view()
}

```

gives me enough to work from…

---

<div class="post-metadata">

### Author: ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/system/32/2402_2.png) [@system](https://community.seqera.io/u/system)
#### Post date: [May 12, 2024, 8:22pm UTC](https://community.seqera.io/t/how-to-process-a-list-of-files-while-knowing-the-file-i-m-processing/735/3 "2024-05-12T20:22:50Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
