<?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: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37465#M26365</link>
    <description>&lt;P&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;At the end I had to add one condition more because when you have these to elements (the folder and the block blob file) Databricks "does not understand" that is a directory so I added this condition:&lt;BR /&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"ckd_tvhdep_parquet"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;file&lt;/SPAN&gt;&lt;SPAN&gt;.name&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;file&lt;/SPAN&gt;&lt;SPAN&gt;.isDir() ==&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;False to remove first the file and after that I could move the folder. Because at that time, when the file was no longer there, Databricks did identify it as a folder.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much anyway, your answer was very useful!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2023 09:14:41 GMT</pubDate>
    <dc:creator>SaraCorralLou</dc:creator>
    <dc:date>2023-07-12T09:14:41Z</dc:date>
    <item>
      <title>dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37248#M26296</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I am contacting you because of the following problem I am having:&lt;/P&gt;&lt;P&gt;In an ADLS folder I have two items, a folder and an automatically generated Block blob file with the same name as the folder.&lt;/P&gt;&lt;P&gt;I want to use the dbutils.fs.mv command to move the folder to another folder but as the Block blob file has the same name it is also being moved together with the folder and this is causing me a problem.&lt;/P&gt;&lt;P&gt;Would it be possible to somehow just specify that I want to move the folder?&lt;/P&gt;&lt;P&gt;Thank you very much in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2023 17:52:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37248#M26296</guid>
      <dc:creator>SaraCorralLou</dc:creator>
      <dc:date>2023-07-09T17:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37253#M26298</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/36086"&gt;@SaraCorralLou&lt;/a&gt;&amp;nbsp; can you share a snapshot for more clarity?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 02:23:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37253#M26298</guid>
      <dc:creator>Hemant</dc:creator>
      <dc:date>2023-07-10T02:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37280#M26311</link>
      <description>&lt;P&gt;Yes, sure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SaraCorralLou_0-1688976633463.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2815i8E874B220A894091/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="SaraCorralLou_0-1688976633463.png" alt="SaraCorralLou_0-1688976633463.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is the situation. The second file is this Block Blob file that does not have extension. The folder is the one that we want to move but when we do dbutils.fs.mv is moving both.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 08:13:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37280#M26311</guid>
      <dc:creator>SaraCorralLou</dc:creator>
      <dc:date>2023-07-10T08:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37284#M26313</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/36086"&gt;@SaraCorralLou&lt;/a&gt;&amp;nbsp; for sharing snapshot, for this you have to handle the code itself while moving:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def move_folders(filepath, destination_path):
    """
    This function moves all folders from the specified filepath to the specified destination_path.

    Args:
     filepath (str): The path to the source folders.
     destination_path (str): The path to the destination folders.
    """

    # Iterate over all files in the source directory.
    for file in dbutils.fs.ls(filepath):
        # Check if the file is a directory.
        if file.isDir():
           # Move the directory to the destination directory.
           dbutils.fs.mv(file.path, destination_path,True)

    # Print a message to indicate that all folders have been moved.
    print("All folders have been moved successfully.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 09:12:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37284#M26313</guid>
      <dc:creator>Hemant</dc:creator>
      <dc:date>2023-07-10T09:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37298#M26316</link>
      <description>&lt;P&gt;Great! Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 12:08:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37298#M26316</guid>
      <dc:creator>SaraCorralLou</dc:creator>
      <dc:date>2023-07-10T12:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37311#M26319</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/36086"&gt;@SaraCorralLou&lt;/a&gt;, can you select it as the answer if it's work for you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 13:53:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37311#M26319</guid>
      <dc:creator>Hemant</dc:creator>
      <dc:date>2023-07-10T13:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37370#M26336</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/36086"&gt;@SaraCorralLou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 10:34:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37370#M26336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-11T10:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37465#M26365</link>
      <description>&lt;P&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;At the end I had to add one condition more because when you have these to elements (the folder and the block blob file) Databricks "does not understand" that is a directory so I added this condition:&lt;BR /&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"ckd_tvhdep_parquet"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;file&lt;/SPAN&gt;&lt;SPAN&gt;.name&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;file&lt;/SPAN&gt;&lt;SPAN&gt;.isDir() ==&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;False to remove first the file and after that I could move the folder. Because at that time, when the file was no longer there, Databricks did identify it as a folder.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much anyway, your answer was very useful!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 09:14:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/37465#M26365</guid>
      <dc:creator>SaraCorralLou</dc:creator>
      <dc:date>2023-07-12T09:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: dbutils.fs.mv - 1 folder and 1 file with the same name and only move the folder</title>
      <link>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/93318#M38675</link>
      <description>&lt;P&gt;What are the possible reasons for the generation of those extra files with same name with zero bytes of data?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 15:03:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbutils-fs-mv-1-folder-and-1-file-with-the-same-name-and-only/m-p/93318#M38675</guid>
      <dc:creator>deep_coder16</dc:creator>
      <dc:date>2024-10-09T15:03:04Z</dc:date>
    </item>
  </channel>
</rss>

