<?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 Check if a given path is file or folder in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-a-given-path-is-file-or-folder/m-p/384094#M21374</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am trying to use your API and to check if a path is a file or a folder. For folders works ok but when I find in my path a file the request crashes with&amp;nbsp;{".tag":"path","path":"not_folder"} (which is normally ).&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;PRE&gt;String currentUrl = url != null? url :"";
		
		ListFolderResult result = UploadFileToDropbox.createDropBoxConnection().files().listFolder(currentUrl);
		if(result.getEntries().size() &amp;gt;0) {
			for (Metadata metadata: result.getEntries()) {
				if(metadata instanceof FileMetadata)
					System.out.println("file");
			}
			
result.getEntries());
		}&lt;/PRE&gt;
&lt;P&gt;How can I check before this line:&lt;/P&gt;
&lt;PRE&gt;		ListFolderResult result = UploadFileToDropbox.createDropBoxConnection().files().listFolder(currentUrl);&lt;/PRE&gt;
&lt;P&gt;If the current URL is a file in order to prevent this request to fail.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Dec 2019 19:52:54 GMT</pubDate>
    <dc:creator>Adrian112</dc:creator>
    <dc:date>2019-12-26T19:52:54Z</dc:date>
    <item>
      <title>Check if a given path is file or folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-a-given-path-is-file-or-folder/m-p/384094#M21374</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am trying to use your API and to check if a path is a file or a folder. For folders works ok but when I find in my path a file the request crashes with&amp;nbsp;{".tag":"path","path":"not_folder"} (which is normally ).&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;PRE&gt;String currentUrl = url != null? url :"";
		
		ListFolderResult result = UploadFileToDropbox.createDropBoxConnection().files().listFolder(currentUrl);
		if(result.getEntries().size() &amp;gt;0) {
			for (Metadata metadata: result.getEntries()) {
				if(metadata instanceof FileMetadata)
					System.out.println("file");
			}
			
result.getEntries());
		}&lt;/PRE&gt;
&lt;P&gt;How can I check before this line:&lt;/P&gt;
&lt;PRE&gt;		ListFolderResult result = UploadFileToDropbox.createDropBoxConnection().files().listFolder(currentUrl);&lt;/PRE&gt;
&lt;P&gt;If the current URL is a file in order to prevent this request to fail.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2019 19:52:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-a-given-path-is-file-or-folder/m-p/384094#M21374</guid>
      <dc:creator>Adrian112</dc:creator>
      <dc:date>2019-12-26T19:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a given path is file or folder</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-a-given-path-is-file-or-folder/m-p/384116#M21376</link>
      <description>&lt;P&gt;You can catch that &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/LookupError.html#NOT_FOLDER" target="_self"&gt;not_folder error&lt;/A&gt;&amp;nbsp;directly from the&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolder-java.lang.String-" target="_self"&gt;listFolder&lt;/A&gt; call to detect and handle that. If you do wish to make another call to check it first though, you can do so by calling&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#getMetadata-java.lang.String-" target="_self"&gt;getMetadata&lt;/A&gt;&amp;nbsp;and checking the subtype of the returned &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/Metadata.html" target="_self"&gt;Metadata&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 17:15:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Check-if-a-given-path-is-file-or-folder/m-p/384116#M21376</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-12-13T17:15:59Z</dc:date>
    </item>
  </channel>
</rss>

