<?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: How to find the last modified date of a notebook? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8704#M4271</link>
    <description>&lt;P&gt;Hi @Naveen Kumar Madas​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Mar 2023 06:33:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-03-07T06:33:17Z</dc:date>
    <item>
      <title>How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8692#M4259</link>
      <description>&lt;P&gt;I would like to find the notebooks that are not required and not being used and then I can review and delete them. If there is a way to find last modified date of a notebook programmatically then I can get a list of notebooks, which I can review and delete them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked the workspace API functions and could not find how to get the last modified date of a notebook.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 10:23:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8692#M4259</guid>
      <dc:creator>Naveen_KumarMad</dc:creator>
      <dc:date>2023-02-27T10:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8693#M4260</link>
      <description>&lt;P&gt;&lt;B&gt;Use Python commands to display creation date and modification date&lt;/B&gt;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;ls&amp;nbsp;command is an easy way to display basic information. If you want more detailed timestamps, you should use Python API calls.&lt;/P&gt;&lt;P&gt;For example, this sample code uses&amp;nbsp;datetime&amp;nbsp;functions to display the creation date and modified date of all listed files and directories in the&amp;nbsp;/dbfs/&amp;nbsp;folder. Replace&amp;nbsp;/dbfs/&amp;nbsp;with the full path to the files you want to display.&lt;/P&gt;&lt;P&gt;%python&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;nbsp;%python
&amp;nbsp;
import os
from datetime import datetime
path = '/dbfs/'
fdpaths = [path+"/"+fd for fd in os.listdir(path)]
print(" file_path " + " create_date " + " modified_date ")
for fdpath in fdpaths:
  statinfo = os.stat(fdpath)
  create_date = datetime.fromtimestamp(statinfo.st_ctime)
  modified_date = datetime.fromtimestamp(statinfo.st_mtime)
  print(fdpath, create_date, modified_date)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt; file_path &amp;nbsp;create_date &amp;nbsp;modified_date&lt;/P&gt;&lt;P&gt;/dbfs//FileStore 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;/dbfs//databricks 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;/dbfs//databricks-datasets 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;/dbfs//databricks-results 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;/dbfs//dbfs 2020-06-09 21:11:24 2020-06-09 21:11:24&lt;/P&gt;&lt;P&gt;/dbfs//local_disk0 2020-05-20 22:32:05 2020-05-20 22:32:05&lt;/P&gt;&lt;P&gt;/dbfs//ml 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;/dbfs//tmp 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;/dbfs//user 2021-07-01 12:49:45.264730 2021-07-01 12:49:45.264730&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Reference:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://kb.databricks.com/en_US/python/display-file-timestamp-details" target="test_blank"&gt;https://kb.databricks.com/en_US/python/display-file-timestamp-details&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 11:34:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8693#M4260</guid>
      <dc:creator>Tayyab_Vohra</dc:creator>
      <dc:date>2023-02-27T11:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8694#M4261</link>
      <description>&lt;P&gt;Hi @Naveen Kumar Madas​&amp;nbsp;, You can use the "revision history" option on the right-side panel to view the last modified date for a notebook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 18:57:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8694#M4261</guid>
      <dc:creator>Lakshay</dc:creator>
      <dc:date>2023-02-27T18:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8695#M4262</link>
      <description>&lt;P&gt;Thanks Tayyab for the code. This works for '/dbfs/', but not working for a notebook path. My notebooks path looks something like this "/dev/abcd/xyz/notebook'. Please let me know if I am missing something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 06:21:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8695#M4262</guid>
      <dc:creator>Naveen_KumarMad</dc:creator>
      <dc:date>2023-02-28T06:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8696#M4263</link>
      <description>&lt;P&gt;@Naveen Kumar Madas​&amp;nbsp;can you please show the error in jpeg or something, you can also print your path of the file before loop iteration, try to print the path, and show it, then I can edit the code.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 07:27:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8696#M4263</guid>
      <dc:creator>Tayyab_Vohra</dc:creator>
      <dc:date>2023-02-28T07:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8697#M4264</link>
      <description>&lt;P&gt;You can use the revision history and if you are using repos. You can check the different commit&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 11:01:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8697#M4264</guid>
      <dc:creator>youssefmrini</dc:creator>
      <dc:date>2023-02-28T11:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8698#M4265</link>
      <description>&lt;P&gt;Here is the error message ( '/dev/adhoc/' is the folder path containing notebooks): &lt;/P&gt;&lt;P&gt;FileNotFoundError: [Errno 2] No such file or directory: '/dev/adhoc/'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I am using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%python
 
import os
from datetime import datetime
path = '/dev/adhoc/'
# path = '/dbfs/'
fdpaths = [path+"/"+fd for fd in os.listdir(path)]
print(" file_path " + " create_date " + " modified_date ")
for fdpath in fdpaths:
  statinfo = os.stat(fdpath)
  create_date = datetime.fromtimestamp(statinfo.st_ctime)
  modified_date = datetime.fromtimestamp(statinfo.st_mtime)
  print(fdpath, create_date, modified_date)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 11:45:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8698#M4265</guid>
      <dc:creator>Naveen_KumarMad</dc:creator>
      <dc:date>2023-02-28T11:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8699#M4266</link>
      <description>&lt;P&gt;1) have you manually checked that the notebook really exists in that folder? because here the error shows that you don't have any notebook in the folder.&lt;/P&gt;&lt;P&gt;2) And if the notebook is inside the folder then please comment out the loop part and print all the file name first. &lt;/P&gt;&lt;P&gt;3) Once you print that then it would be easily accessible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because after checking your error it shows that the notebook is not inside the folder.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 13:08:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8699#M4266</guid>
      <dc:creator>Tayyab_Vohra</dc:creator>
      <dc:date>2023-02-28T13:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8700#M4267</link>
      <description>&lt;P&gt;Your ask was how to do this programmatically, here is an example where you can use the &lt;A href="https://docs.databricks.com/api-explorer/workspace/workspace/list" alt="https://docs.databricks.com/api-explorer/workspace/workspace/list" target="_blank"&gt;workspace 2.0 API to get this information with the list function&lt;/A&gt;. See my example below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;❯ curl --netrc --request GET \
  &lt;A href="https://workspaceURL/api/2.0/workspace/list" target="test_blank"&gt;https://workspaceURL/api/2.0/workspace/list&lt;/A&gt; \
  --header 'Accept: application/json' \
  --data '{ "path": "/Users/nathan.anthony@databricks.com/", "recursive": true }' 
&amp;nbsp;
{
  "objects": [
    {
      "object_type": "NOTEBOOK",
      "path": "/Users/nathan.anthony@databricks.com/NotebookA",
      "language": "SQL",
      "created_at": 1670968138861,
      "modified_at": 1671133083375,
      "object_id": 37800453517611
    },
    {
      "object_type": "DIRECTORY",
      "path": "/Users/nathan.anthony@databricks.com/testDirectory",
      "object_id": 250599769035380
    },
    {
      "object_type": "NOTEBOOK",
      "path": "/Users/nathan.anthony@databricks.com/testNotebook",
      "language": "SQL",
      "created_at": 1662656912698,
      "modified_at": 1669064685778,
      "object_id": 250599769035457
    },&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 16:24:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8700#M4267</guid>
      <dc:creator>NateAnth</dc:creator>
      <dc:date>2023-02-28T16:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8701#M4268</link>
      <description>&lt;P&gt;Additionally, if you want this in CSV, you could try piping the output into a utility such as jq&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Example: &lt;/B&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;curl ..... | jq -r '.objects[] | [.object_type, .path, .language, .modified_at] | @csv'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 16:30:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8701#M4268</guid>
      <dc:creator>NateAnth</dc:creator>
      <dc:date>2023-02-28T16:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8702#M4269</link>
      <description>&lt;P&gt;Please see the attached picture. Under Workspace, you will see 'dev' folder, which in turn contains 3 sub folders. My notebook exists in one of the sub folder. But, 'os.listdir(''/dev/')' shows different list of directories/filenames instead of the 3 sub-folders I see in the picture. It looks like 'os.listdir' command is referring to a different 'dev' folder, but not the one under Workspace. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 10:40:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8702#M4269</guid>
      <dc:creator>Naveen_KumarMad</dc:creator>
      <dc:date>2023-03-01T10:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8703#M4270</link>
      <description>&lt;P&gt;Thanks @Nathan Anthony​. This works.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 11:10:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8703#M4270</guid>
      <dc:creator>Naveen_KumarMad</dc:creator>
      <dc:date>2023-03-01T11:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8704#M4271</link>
      <description>&lt;P&gt;Hi @Naveen Kumar Madas​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 06:33:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8704#M4271</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-07T06:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the last modified date of a notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8705#M4272</link>
      <description>&lt;P&gt;Hi @Naveen Kumar Madas​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can go through below code block&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sh&lt;/P&gt;&lt;P&gt;ls -lt /dbfs/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 07:14:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-find-the-last-modified-date-of-a-notebook/m-p/8705#M4272</guid>
      <dc:creator>Amit_352107</dc:creator>
      <dc:date>2023-03-23T07:14:50Z</dc:date>
    </item>
  </channel>
</rss>

