title: How to create a column which content is the file name
body: <p>I need to merge several files in one folder, but before that I need to create a column (called &quot;date&quot;) in which to write the name of the file (the file name is the collection date), so when they are bind together I can tell from when the records came. I get new files every month, so the idea is to add this to a loop, so I don't have to do it file by file. So far I manage to bind them together with this code:</p>
  <pre><code>my.files &lt;- files &lt;- list.files(path=&quot;F:/new folder/PA&quot;, pattern=&quot;*.unl&quot;)
  imported.files &lt;- sapply(my.files, read.delim, sep = &quot;|&quot;, header = F) 
  total_file &lt;- do.call(&quot;rbind.fill&quot;, imported.files)
  names(total_file) &lt;- colnames
  </code></pre>
  <p>Any help would be greatly appreciated.</p>