# Get Input Filename

**URL:** <https://forum.cloverdx.com/t/get-input-filename/477>\
**Category:** CloverDX Platform\
**Created:** [February 18, 2009, 12:00am UTC](https://forum.cloverdx.com/t/get-input-filename/477 "2009-02-18T00:00:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![scndmouse](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@scndmouse](https://forum.cloverdx.com/u/scndmouse)\
**Post date:** [February 18, 2009, 12:00am UTC](https://forum.cloverdx.com/t/get-input-filename/477/1 "2009-02-18T00:00:00Z")

</div>

new to clover. Using CloverGUI 2.1.1.

I have a graph where I read all files in a given input directory (UniversalDataReader, fileURL= ${DATAIN\_DIR}/\*). One of my writers is a UniversalDataWriter where I want the output filename be the same as the input, only with a different extension.

Any ideas are much appreciated.

Thanks,

---

<div class="post-metadata">

**Author:** ![scndmouse](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@scndmouse](https://forum.cloverdx.com/u/scndmouse)\
**Post date:** [February 18, 2009, 11:51pm UTC](https://forum.cloverdx.com/t/get-input-filename/477/2 "2009-02-18T23:51:55Z")

</div>

Additionally, I seem to be having difficulties with the wildcard recognition for the Reader. According to the manual:  
[http://www.cloveretl.org/\_upload/clover-gui/docs/html/manual\_html\_chunk/ch17.html#d0e8151](http://www.cloveretl.org/%5Fupload/clover-gui/docs/html/manual%5Fhtml%5Fchunk/ch17.html#d0e8151)  
The syntax I have for fileURL should grab all files in the directory. However, this doesn’t seem to be the case. It will only grab the first file.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [February 19, 2009, 9:59am UTC](https://forum.cloverdx.com/t/get-input-filename/477/3 "2009-02-19T09:59:15Z")

</div>

My graph reads all the files from the designated directory. Could you show your graph?  
To your first question:  
When reading you can add to your metadata field with _auto\_filling=“source\_name”_ and when writing you can use attributes _partition_, _partitionFileTag_, _partitionKey_ and _partitionOutFields_.

---

<div class="post-metadata">

**Author:** ![scndmouse](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@scndmouse](https://forum.cloverdx.com/u/scndmouse)\
**Post date:** [February 19, 2009, 4:46pm UTC](https://forum.cloverdx.com/t/get-input-filename/477/4 "2009-02-19T16:46:50Z")

</div>

Here’s a simple one. UniversalDataReader with fileURL=${DATAIN\_DIR}/\*.txt, sending output to Trash.

```auto

<?xml version="1.0" encoding="UTF-8"?>
<Graph author="scndmouse" created="Wed Feb 18 19:55:05 GMT-05:00 2009" guiVersion="2.1" id="1235006073559" licenseType="Evaluation license." modified="Thu Feb 19 11:43:40 GMT-05:00 2009" modifiedBy="scndmouse" name="test2" revision="1.77">
<Global>
<Metadata id="Metadata0" previewAttachmentCharset="ISO-8859-1">
<Record fieldDelimiter=":" name="recordName1" previewAttachmentCharset="ISO-8859-1" recordDelimiter="\n" type="delimited">
<Field name="field1" type="string"/>
<Field name="field2" type="string"/>
</Record>
</Metadata>
<Property fileURL="workspace.prm" id="GraphParameter0"/>
</Global>
<Phase number="0">
<Node enabled="enabled" fileURL="${DATAIN_DIR}/*.txt" guiHeight="0" guiName="UniversalDataReader" guiWidth="0" guiX="128" guiY="160" id="DATA_READER0" numRecords="1" skipRows="3" type="DATA_READER"/>
<Edge debugMode="true" fromNode="DATA_READER0:0" guiBendpoints="" id="Edge1" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (output)" toNode="TRASH0:0"/>
</Phase>
<Phase number="1">
<Node enabled="enabled" guiHeight="0" guiName="Trash" guiWidth="0" guiX="352" guiY="156" id="TRASH0" type="TRASH"/>
</Phase>
</Graph>

```

allow me to play dumb and ask, where do set the _auto\_filling_ attribute using cloverGUI?

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [February 20, 2009, 8:29am UTC](https://forum.cloverdx.com/t/get-input-filename/477/5 "2009-02-20T08:29:05Z")

</div>

Your graph read only one record, because you’ve set it (Max number of records) - if you want to read all records don’t set this parameter.  
Auto filling you can set in metadata editor (see [Metadata Editor](http://www.cloveretl.org/%5Fupload/clover-gui/docs/html/manual%5Fhtml%5Fchunk/ch09s07.html))

---

<div class="post-metadata">

**Author:** ![scndmouse](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@scndmouse](https://forum.cloverdx.com/u/scndmouse)\
**Post date:** [February 20, 2009, 4:12pm UTC](https://forum.cloverdx.com/t/get-input-filename/477/6 "2009-02-20T16:12:16Z")

</div>

ok. changed the parameter and verified that it does read all files. But that’s not exactly what I was hoping for. I was expecting the “Skip rows” and “Max number of rows” parameters to be applied per file. Instead it seems like the Reader is just concatenating both files into a single stream (only skipping the number of rows defined in the first file).

I guess I’m looking for a way to iterate over a set of files and apply the same transform _per file_.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [February 25, 2009, 9:10am UTC](https://forum.cloverdx.com/t/get-input-filename/477/7 "2009-02-25T09:10:41Z")

</div>

Your request has been reported ([http://bug.cloveretl.org/view.php?id=1502](http://bug.cloveretl.org/view.php?id=1502)) and will be implemented in next version. In time being you have to use Reformat node, with your transformation skipping records from each input file.

---

<div class="post-metadata">

**Author:** ![dpavlis](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dpavlis](https://forum.cloverdx.com/u/dpavlis)\
**Post date:** [March 19, 2009, 9:51am UTC](https://forum.cloverdx.com/t/get-input-filename/477/8 "2009-03-19T09:51:10Z")

</div>

You may also use Dedup component and set the dedup key be name of the file - field, where the name is stored. Then you can specify whether you want first one, two, three,… records from each file.
