{"id":14741,"date":"2021-12-15T13:54:00","date_gmt":"2021-12-15T13:54:00","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=14741"},"modified":"2021-12-15T13:55:05","modified_gmt":"2021-12-15T13:55:05","slug":"batch-to-add-filename-as-first-column","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-to-add-filename-as-first-column\/24851.html","title":{"rendered":"Batch To Add Filename As First Column"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I am in desperate need of assistance. I have been browsing the forums here and have tried modifying several examples for nearly 4 hours, I&#8217;m not entirely sure of the syntax and what I am doing, thus I am not able to get the results I want.<\/p>\n<p>I need to add the filename of a CSV file as the first column of the CSV, with a first row header name of &#8220;ID&#8221;. I would like to be able to run this batch on a collection of CSV files contained within a directory and have it insert the column with the respective filename in each file.<\/p>\n<p>Here is a link to a unaltered CSV for reference:<br \/>\n<a href=\"https:\/\/web.archive.org\/web\/20161118101553\/http:\/\/www.mediafire.com\/file\/ph7c5nb96l6kev1\/LDW2720.csv\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/www.mediafire.com\/file\/ph7c5&#8230;<\/a><\/p>\n<p>I&#8217;m obviously out of my element, and I would sincerely appreciate any assistance that someone may be able to provide.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":9},"question-category":[55],"question_tags":[],"class_list":["post-14741","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/14741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=14741"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=14741"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=14741"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=14741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}