<?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 Re: Create a folder in modelbuilder with today's date in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374554#M77920</link>
    <description>&lt;P&gt;You can add a Calculate Field model builder tool which has a Python script to calculate the date and output as a string.&amp;nbsp; You'd then use the output (I think defaults to 'Value') in an inline variable substitution for the output filename for whatever tool.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/calculate-value.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/calculate-value.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Python script (not in codeblock, just in the expression box.&amp;nbsp; Data Type=String.&lt;/P&gt;&lt;P&gt;datetime.datetime.now().strftime("%Y_%m_%d")&lt;/P&gt;&lt;P&gt;That should then have an output called 'Value' (you can rename this of-course)&lt;/P&gt;&lt;P&gt;Then when you write the output filename in another tool:&lt;/P&gt;&lt;P&gt;%Value%_myFilename.extension&lt;/P&gt;&lt;P&gt;goes to -&amp;gt; 2024_01_25_myFilename.extension&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 18:23:12 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2024-01-25T18:23:12Z</dc:date>
    <item>
      <title>Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374443#M77912</link>
      <description>&lt;P&gt;Hi Community.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a model to package up some data to send off to another office.&amp;nbsp; One part of my model is a new folder for the new file geodatabase.&amp;nbsp; Is there a way to automatically name the folder to today's date?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 16:14:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374443#M77912</guid>
      <dc:creator>KevinDicks</dc:creator>
      <dc:date>2024-01-25T16:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374552#M77919</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I think one way you can do this is via a Python script tool.&lt;/P&gt;&lt;P&gt;I would carry out the following:&lt;/P&gt;&lt;P&gt;1: Copy the code below into a Python script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from datetime import datetime# Module for calculating dates &amp;amp; times

path = arcpy.GetParameterAsText(0)      # Receive data from Script tool dialog
gdbName = arcpy.GetParameterAsText(1)   # Receive data from script tool dialog

# Calculate the date (you can amend this to add the time also..)
curDate = datetime.now()
year = curDate.year
month = curDate.month
day = curDate.day

gdbNameDate = f"{year}_{month}_{day}_{gdbName}"

#Call the Create File Geodatabase geoprocessing tool
arcpy.arcpy.management.CreateFileGDB(path, gdbNameDate)&lt;/LI-CODE&gt;&lt;P&gt;2: The lines of code - &lt;EM&gt;arcpy.GetParameterAsText()&lt;/EM&gt; allow the script to receive data from outside of the script. You will pass the geodatabase pathway and its name into the script. &lt;EM&gt;GetParameterAsText(0)&lt;/EM&gt; receives the pathway for the geodatabase while &lt;EM&gt;GetParameterAsText(1)&lt;/EM&gt; receives the chosen name of the geodatabase.&lt;/P&gt;&lt;P&gt;3: Create a Python Script tool in, for example, your project's default toolbox. (&lt;EM&gt;Right click the toolbo&lt;/EM&gt;x &amp;gt; &lt;STRONG&gt;New&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Script&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;This will display the Python Script tool properties dialog. There are 4 tabs down the left hand side.&lt;/P&gt;&lt;P&gt;4: On the &lt;STRONG&gt;General&lt;/STRONG&gt; tab, provide a &lt;EM&gt;Name&lt;/EM&gt; &amp;amp;&amp;nbsp; &lt;EM&gt;Label&lt;/EM&gt; for the script tool.&lt;/P&gt;&lt;P&gt;5: On the &lt;STRONG&gt;Parameters&lt;/STRONG&gt; tab you need to create 2 parameters here.&lt;/P&gt;&lt;P&gt;The first parameter is the &lt;EM&gt;geodatabase pathway&lt;/EM&gt;.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Provide a &lt;STRONG&gt;label&lt;/STRONG&gt;. This is what the user will see as the title of the parameter on the dialog.&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;workspace&lt;/STRONG&gt; as the &lt;EM&gt;datatype&lt;/EM&gt;. You should set a &lt;EM&gt;filter&lt;/EM&gt;, choosing &lt;STRONG&gt;workspace&lt;/STRONG&gt; and then tick &lt;STRONG&gt;File System&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The second parameter is the g&lt;EM&gt;eodatabase name&lt;/EM&gt;.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Provide a label. This is what the user will see as the title of the parameter on the dialog.&lt;/LI&gt;&lt;LI&gt;Set a &lt;STRONG&gt;default value&lt;/STRONG&gt;, for example &lt;EM&gt;Streets.gdb&lt;/EM&gt;.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;So:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="EdMorris_0-1706206028735.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92847iF015134DCF67F6F6/image-size/large?v=v2&amp;amp;px=999" role="button" title="EdMorris_0-1706206028735.png" alt="EdMorris_0-1706206028735.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The ordering of these parameters on the Tool Properties dialog is important as the order on the dialog determines the order in which the values are passed into the script via arcpy.GetParameterAsText()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;6: Click the &lt;STRONG&gt;Execution&lt;/STRONG&gt; tab and for &lt;EM&gt;Script File&lt;/EM&gt; browse to the location of the python script!&lt;/P&gt;&lt;P&gt;7: Once your are finished double click the Python Script tool:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdMorris_2-1706206839253.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92853i9A404C428FD9E0BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdMorris_2-1706206839253.png" alt="EdMorris_2-1706206839253.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script tool dialog will then display.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdMorris_1-1706206756794.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92852iF69E19C1395C9441/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdMorris_1-1706206756794.png" alt="EdMorris_1-1706206756794.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;8: Fill in the dialog parameters and press &lt;STRONG&gt;Run&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;That should be everything you need to know... and will create a new file geodatabase with the current date as part of its name...&lt;/P&gt;&lt;P&gt;Have fun ed&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 18:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374552#M77919</guid>
      <dc:creator>EdMorris</dc:creator>
      <dc:date>2024-01-25T18:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374554#M77920</link>
      <description>&lt;P&gt;You can add a Calculate Field model builder tool which has a Python script to calculate the date and output as a string.&amp;nbsp; You'd then use the output (I think defaults to 'Value') in an inline variable substitution for the output filename for whatever tool.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/calculate-value.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/calculate-value.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Python script (not in codeblock, just in the expression box.&amp;nbsp; Data Type=String.&lt;/P&gt;&lt;P&gt;datetime.datetime.now().strftime("%Y_%m_%d")&lt;/P&gt;&lt;P&gt;That should then have an output called 'Value' (you can rename this of-course)&lt;/P&gt;&lt;P&gt;Then when you write the output filename in another tool:&lt;/P&gt;&lt;P&gt;%Value%_myFilename.extension&lt;/P&gt;&lt;P&gt;goes to -&amp;gt; 2024_01_25_myFilename.extension&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 18:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374554#M77920</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2024-01-25T18:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374779#M77940</link>
      <description>&lt;P&gt;Morning&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/330803"&gt;@KevinDicks&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;suggestion is a much more elegant solution so i would suggest you go David's. Nicely done David.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 09:54:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374779#M77940</guid>
      <dc:creator>EdMorris</dc:creator>
      <dc:date>2024-01-26T09:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374790#M77942</link>
      <description>&lt;P&gt;This isn’t my area of expertise, but for anyone like me who’s looking for more info, just Google&amp;nbsp;"arcgis" "inline variable":&amp;nbsp;&lt;BR /&gt;&lt;A href="https://www.google.ca/search?q=%22arcgis%22+%22Inline+variable%22" target="_blank" rel="noopener"&gt;https://www.google.ca/search?q=%22arcgis%22+%22Inline+variable%22&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A somewhat related idea: &lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/inline-variable-for-populating-date-datatype-field/idi-p/1281623" target="_self"&gt;Inline variable for populating date datatype field&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose it might also be possible to get the system date using SQL in a database view. &lt;STRIKE&gt;Or maybe even editor tracking.&lt;/STRIKE&gt;&lt;/P&gt;&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/manage-file-gdb/sql-reporting-and-anlysis-file-geodatabases.htm" target="_self"&gt;SQL for reporting and analysis on file geodatabases&lt;/A&gt;&lt;BR /&gt;Date Functions&lt;/P&gt;&lt;DIV class=""&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Function&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;CURRENT_DATE&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Returns the current date.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;EXTRACT (&lt;I&gt;extract_field&lt;/I&gt;FROM &lt;I&gt;extract_source&lt;/I&gt;)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Returns the&lt;I&gt; extract_field&lt;/I&gt; portion of the&lt;I&gt;extract_source&lt;/I&gt;. The &lt;I&gt;extract_source&lt;/I&gt; argument is a date-time expression. The &lt;I&gt;extract_field&lt;/I&gt; argument can be one of the following keywords: YEAR, MONTH, DAY, HOUR, MINUTE, or SECOND.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;CURRENT TIME&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Returns the current time.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;CURRENT_TIMESTAMP&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Returns the current time and date.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 Jan 2024 11:37:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374790#M77942</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-26T11:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374925#M77960</link>
      <description>&lt;P&gt;Thanks for the suggestions everyone!&amp;nbsp; I will try these out.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 17:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1374925#M77960</guid>
      <dc:creator>KevinDicks</dc:creator>
      <dc:date>2024-01-26T17:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder in modelbuilder with today's date</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1375018#M77967</link>
      <description>&lt;P&gt;From the man who taught me my first Python with arcpy. Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/135968"&gt;@EdMorris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 19:14:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-a-folder-in-modelbuilder-with-today-s-date/m-p/1375018#M77967</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2024-01-26T19:14:37Z</dc:date>
    </item>
  </channel>
</rss>

