<?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: Using python delete old tables with date and time in table's name in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60167#M4795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael, the last line in the post is copied from the help suggesting that the ability to delete multiple elements began with Pro 2.4.&amp;nbsp; Esri doesn't backport enhancements to previous versions, and the ArcMap help for 10.7 would have to be consulted to see if the capability also exists there.&amp;nbsp; Generally arcmap and pro keep in step, but I don't use arcmap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Aug 2019 10:53:06 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2019-08-13T10:53:06Z</dc:date>
    <item>
      <title>Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60162#M4790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been using ArcGIS 10.3.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a list of tables in an enterprise geodatabase with date and time in the table name. Every day one table is created, as an outcome of some geoprocessing tasks with the date and time in the table’s name when the table is created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naming format of the tables are FHRT_YYYYmmdd_HHMMSS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like&lt;/P&gt;&lt;OL style="margin-top: 0cm;"&gt;&lt;LI style="margin-left: 0cm;"&gt;&lt;SPAN style="color: #0070c0;"&gt;FHRT_20190808_071015&lt;/SPAN&gt; (this table is created on 08 August 2019 at 07:10:15)&lt;/LI&gt;&lt;LI style="margin-left: 0cm;"&gt;&lt;SPAN style="color: #0070c0;"&gt;FHRT_20190807_071218&lt;/SPAN&gt; (this table is created on 07 August 2019 at 07:12:18)&lt;/LI&gt;&lt;LI style="color: #0070c0; margin-left: 0cm;"&gt;FHRT_20190806_071119&lt;/LI&gt;&lt;LI style="margin-left: 0cm;"&gt;FHRT_20190805_071913&lt;/LI&gt;&lt;LI style="margin-left: 0cm;"&gt;FHRT_20190804_071418&lt;/LI&gt;&lt;LI style="margin-left: 0cm;"&gt;FHRT_20190803_071014&lt;/LI&gt;&lt;LI style="margin-left: 0cm;"&gt;FHRT_20190802_070815&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a python script that will keep the latest 3 tables (in this example &lt;SPAN style="color: #0070c0;"&gt;FHRT_20190808_071015, FHRT_20190807_071218 and FHRT_20190806_071119&lt;/SPAN&gt;) and delete the rest with similar name format. The geodatabase may have other tables with other name format (cadastre, property etc.), I do not want to touch those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Being new in Python I do not know how I would create&amp;nbsp;the script that will specify the dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean how will I instruct the script to keep the 3 tables that have the latest dates and delete the older tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What module do i need to import and what would be the statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hafiz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2019 06:00:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60162#M4790</guid>
      <dc:creator>SheikhHafiz1</dc:creator>
      <dc:date>2019-08-08T06:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60163#M4791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems you are very new to Python/ArcPy. If so, you will need to learn to walk before you try running (not that your question is all that complicated).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recommend starting with learning how to list feature classes in a workspace.&amp;nbsp; Once you that process, then you can start manipulating the list to find the 3 most recent tables.&amp;nbsp;&amp;nbsp; I personally prefer using &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/walk.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/walk.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Walk—Help | ArcGIS Desktop&lt;/A&gt; since it mimics native Python file system functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In terms of finding the most recent 3 tables based on datetimes in table names, the structure of your naming convention should allow you to not bother with actually converting the date string to Python datetime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; fhrt_tables &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# List of tables starting with FHRT&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190808_071015"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190807_071218"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190806_071119"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190805_071913"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190804_071418"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190803_071014"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;     &lt;SPAN class="string token"&gt;"FHRT_20190802_070815"&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; recent_three &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sorted&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fhrt_tables&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; reverse&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; recent_three
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FHRT_20190808_071015'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'FHRT_20190807_071218'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'FHRT_20190806_071119'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:17:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60163#M4791</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-10T22:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60164#M4792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua,&lt;/P&gt;&lt;P&gt;Thank you for your quick help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to delete old three tables and&amp;nbsp;I created the script like the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = "\\\\main\\gis_data\\FHRITest.gdb"&lt;BR /&gt;Tables = arcpy.ListTables("FHRT_20*")&lt;BR /&gt;print(Tables)&lt;BR /&gt;old_three = sorted(Tables, reverse=False)[:3]&lt;/P&gt;&lt;P&gt;print ("\n" + "Following are the tables:" + "\n")&lt;/P&gt;&lt;P&gt;print (old_three)&lt;BR /&gt;arcpy.Delete_management(old_three, "table")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the script is throwing the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[u'FHRT_20190805_161001', u'FHRT_20190805_161142', u'FHRT_20190805_162929', u'FHRT_20190805_163204', u'FHRT_20190805_163527']&lt;/P&gt;&lt;P&gt;Following are the tables:&lt;/P&gt;&lt;P&gt;[u'FHRT_20190805_161001', u'FHRT_20190805_161142', u'FHRT_20190805_162929']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Traceback (most recent call last):&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; File "N:\Scripts\DeleteOldTables.py", line 11, in &amp;lt;module&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; arcpy.Delete_management(old_three, "table")&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 4092, in Delete&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; raise e&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;RuntimeError: Object: Error in executing tool&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It must be very easy for you to resolve the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 03:32:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60164#M4792</guid>
      <dc:creator>SheikhHafiz1</dc:creator>
      <dc:date>2019-08-13T03:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60165#M4793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will have to delete them one at a time since you can only delete multiple data elements since ArcGIS Pro 2.4.&amp;nbsp; You will have to use a for loop in your code&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/delete.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/delete.htm"&gt;Delete—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Starting in &lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;ArcGIS Pro 2.4&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;, the &lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Delete&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; tool can be used to delete multiple items.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 07:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60165#M4793</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-08-13T07:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60166#M4794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan:&lt;/P&gt;&lt;P&gt;If the code sample was formatted to run with python 3.x that is bundled with Pro 2.4, a list of items would be able to be deleted all at once instead of in a loop?&amp;nbsp; I would guess this type of capability would never be ported to python 2.x that is bundled with ArcMap as python 2.x and ArcMap, although not retired, are in the process of being retired over the next 2-5 years?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 10:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60166#M4794</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2019-08-13T10:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60167#M4795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael, the last line in the post is copied from the help suggesting that the ability to delete multiple elements began with Pro 2.4.&amp;nbsp; Esri doesn't backport enhancements to previous versions, and the ArcMap help for 10.7 would have to be consulted to see if the capability also exists there.&amp;nbsp; Generally arcmap and pro keep in step, but I don't use arcmap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 10:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60167#M4795</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-08-13T10:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60168#M4796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created the following script to delete one table from an SDE database connection. When I change the workspace path to a local file geodatabase it works fine but the sde database connection doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;Delete_succeeded = "true"&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = "C:\\Users\\app_arcgis\\AppData\\Roaming\\ESRI\\Desktop10.3\\ArcCatalog\\VMAPPDBUAT_GISDEL_GIS.sde"&lt;BR /&gt;Tables = arcpy.ListTables("FHRT_20*")&lt;BR /&gt;print(Tables)&lt;BR /&gt;old_one = sorted(Tables, reverse=False)[:1]&lt;BR /&gt;print ("\n")&lt;BR /&gt;for one in old_one:&lt;BR /&gt; print(one)&lt;BR /&gt;arcpy.Delete_management(one)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I am getting the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:\Scripts\DeleteOldTable.py", line 13, in &amp;lt;module&amp;gt;&lt;BR /&gt; arcpy.Delete_management(one)&lt;BR /&gt;NameError: name 'one' is not defined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me to resolve?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 23:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60168#M4796</guid>
      <dc:creator>Sehafiz</dc:creator>
      <dc:date>2019-08-13T23:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60169#M4797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would help with line numbers, since it is failing on line 13, and I can only see 9.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 00:50:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60169#M4797</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-08-14T00:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60170#M4798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

Delete_succeeded &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"true"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\Users\\app_arcgis\\AppData\\Roaming\\ESRI\\Desktop10.3\\ArcCatalog\\VMAPPDBUAT_GISDEL_GIS.sde"&lt;/SPAN&gt;

Tables &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListTables&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FHRT_20*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Tables&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
old_one &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sorted&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Tables&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; reverse&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; one &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; old_one&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;one&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;one&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Above is the code and the error is as follows&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;



Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  File &lt;SPAN class="string token"&gt;"C:\FishHealth\Scripts\DeleteOldTable.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;13&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;one&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
NameError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; name &lt;SPAN class="string token"&gt;'one'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; defined
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for your help Dan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:17:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60170#M4798</guid>
      <dc:creator>Sehafiz</dc:creator>
      <dc:date>2021-12-10T22:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60171#M4799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Tables&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  

&lt;SPAN class="comment token"&gt;# change to....&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{} tables found\n{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;len&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Tables&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Tables&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;just to make sure there is something.&amp;nbsp; And if there is and if you want to delete, move it up to line 12 and indent by 4 spaces&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:17:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60171#M4799</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-10T22:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60172#M4800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code now looks like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

Delete_succeeded &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"true"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\Users\\app_arcgis\\AppData\\Roaming\\ESRI\\Desktop10.3\\ArcCatalog\\VMAPPDBUAT_GISDEL_GIS.sde"&lt;/SPAN&gt;

Tables &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListTables&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FHRT_20*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

old_one &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sorted&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Tables&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; reverse&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; one &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; old_one&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;one&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{} tables found\n{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;len&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Tables&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Tables&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;one&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and the error is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 



Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  File &lt;SPAN class="string token"&gt;"C:\FishHealth\Scripts\DeleteOldTable.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;13&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;one&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
NameError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; name &lt;SPAN class="string token"&gt;'one'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; defined
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; ‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although your code works for a file geodatabase saved locally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:17:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60172#M4800</guid>
      <dc:creator>Sehafiz</dc:creator>
      <dc:date>2021-12-10T22:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60173#M4801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looking at Line #02 of your results:&lt;/P&gt;&lt;P&gt;[]&lt;/P&gt;&lt;P&gt;That line shows that Tables is an empty list, i.e., there are no tables being returned from arcpy.ListTables.&amp;nbsp; Since Tables is empty, sorted will also return an empty list, and your line "for one in old_one" will never be execute and create the variable "one".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your issue is with listing tables, not deleting them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 03:40:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60173#M4801</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-08-14T03:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60174#M4802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is happening only when the workspace is an sde database connection (C:\\Users\\app_arcgis\\AppData\\Roaming\\ESRI\\Desktop10.3\\ArcCatalog\\&lt;STRONG&gt;VMAPPDBUAT_GISDEL_GIS.sde&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code lists tables when the workspace is a file geodatabase (&lt;A&gt;\\\\scamain\\gis_data\\FHRITest\\&lt;STRONG&gt;FHRITest.gdb&lt;/STRONG&gt;&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;and deletes the table listed in line 6 of the following result, which is the oldest in the tables' list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 


&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt; tables found
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;u&lt;SPAN class="string token"&gt;'FHRT_20190810_070048'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190814_070034'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_153517'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_153907'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_154351'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_154438'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_154801'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_154945'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_155547'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;'FHRT_20190813_155829'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
FHRT_20190810_070048
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; ‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:17:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60174#M4802</guid>
      <dc:creator>SheikhHafiz1</dc:creator>
      <dc:date>2021-12-10T22:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60175#M4803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can't even get a list of tables from *.sde, then they either aren't there or there is something inherently wrong with the workspace and/or the connection.&lt;/P&gt;&lt;P&gt;Also, I noticed "Desktop 10.3' in the path.&amp;nbsp; It might be prudent to upgrade to rule out searching for an old 'bug' that is now fixed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 04:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60175#M4803</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-08-14T04:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using python delete old tables with date and time in table's name</title>
      <link>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60176#M4804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Managed to resolve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;Tables &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListTables&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FHRT_20*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have used&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;Tables &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListTables&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"GISTEST.TEST.FHRT_20*"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;as the wild card. I missed the database and the user name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you Dan and Joshua for your kind effort to help me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 05:45:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-delete-old-tables-with-date-and-time/m-p/60176#M4804</guid>
      <dc:creator>SheikhHafiz1</dc:creator>
      <dc:date>2019-08-14T05:45:14Z</dc:date>
    </item>
  </channel>
</rss>

