<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to add a current date as suffix while using copy? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13143#M7857</link>
    <description>&lt;P&gt;how to add a current date after filename suffix while copy from the dbutils like report20221223.xlsx&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;dbutils.fs.cp('dbfs://temp/balancing/report.xlsx','abfss://con@adls/provsn/result/report.xlsx',True)&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;i need to add the current date in the file like report20220123.xlsx while copying from source to target location&lt;/P&gt;&lt;P&gt;how can we add a current date after the suffix in filename while using dbutils.​&lt;/P&gt;</description>
    <pubDate>Sat, 07 Jan 2023 15:04:08 GMT</pubDate>
    <dc:creator>databicky</dc:creator>
    <dc:date>2023-01-07T15:04:08Z</dc:date>
    <item>
      <title>How to add a current date as suffix while using copy?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13143#M7857</link>
      <description>&lt;P&gt;how to add a current date after filename suffix while copy from the dbutils like report20221223.xlsx&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;dbutils.fs.cp('dbfs://temp/balancing/report.xlsx','abfss://con@adls/provsn/result/report.xlsx',True)&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;i need to add the current date in the file like report20220123.xlsx while copying from source to target location&lt;/P&gt;&lt;P&gt;how can we add a current date after the suffix in filename while using dbutils.​&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 15:04:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13143#M7857</guid>
      <dc:creator>databicky</dc:creator>
      <dc:date>2023-01-07T15:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a current date as suffix while using copy?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13144#M7858</link>
      <description>&lt;P&gt;This will give you a little bit more idea&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import time
&amp;nbsp;
timestr = time.strftime("%Y%m%d-%H%M%S")
&amp;nbsp;
print(timestr)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now you can use formator and implement this solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Aviral&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 15:40:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13144#M7858</guid>
      <dc:creator>Aviral-Bhardwaj</dc:creator>
      <dc:date>2023-01-07T15:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a current date as suffix while using copy?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13145#M7859</link>
      <description>&lt;P&gt;@Mohammed sadamusean​&amp;nbsp;hope the below code might help you, &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from datetime import datetime
date_value = datetime.now().strftime("%Y%m%d")
&amp;nbsp;
src = 'dbfs:/FileStore/Test/File.csv'
trgt = f'dbfs:/FileStore/Test/File_{date_value}.csv' 
&amp;nbsp;
dbutils.fs.cp(src,trgt)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Happy Learning!!&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 17:03:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13145#M7859</guid>
      <dc:creator>Chaitanya_Raju</dc:creator>
      <dc:date>2023-01-07T17:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a current date as suffix while using copy?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13147#M7861</link>
      <description>&lt;P&gt;how can we get the data without hyphen​&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 12:34:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13147#M7861</guid>
      <dc:creator>databicky</dc:creator>
      <dc:date>2023-01-10T12:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a current date as suffix while using copy?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13148#M7862</link>
      <description>&lt;P&gt;You can try like below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from datetime import datetime
datevalue = datetime.now().strftime("%Y%m%d")
 
src = 'dbfs:/FileStore/Test/File.csv'
trgt = f'dbfs:/FileStore/Test/File{datevalue}.csv' 
 
dbutils.fs.cp(src,trgt)
&amp;nbsp;
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Happy Learning!!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 13:44:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-current-date-as-suffix-while-using-copy/m-p/13148#M7862</guid>
      <dc:creator>Chaitanya_Raju</dc:creator>
      <dc:date>2023-01-10T13:44:21Z</dc:date>
    </item>
  </channel>
</rss>

