Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am trying to read files in DropBox folders on my Mac with java.
The following code:
String dir
= "/Users/brucewilcox/Library/CloudStorage/Dropbox/Apps/Form8949DotCom/taxdochub-forms-pdf/XXXX";
File directory = new File( dir );
boolean canRead = directory.canRead( );
String message = String.format( "canRead is: %s", canRead );
System.out.println( message );
emits
canRead is: false
The directory object exists, is a directory, and display an absolute path.
What is the root cause of this?
How can I fix?
Thank you.
Hi @BruceVWilcox,
The local Dropbox folder should be readable. The issue you are encountering is most likely a local permissions issue.
Since the behavior you are describing is not an error from the Dropbox API itself, we can't offer much more help with that in particular.
@DB-Des wrote:Hi @BruceVWilcox,
The local Dropbox folder should be readable. The issue you are encountering is most likely a local permissions issue.
Since the behavior you are describing is not an error from the Dropbox API itself, we can't offer much more help with that in particular.
The folder is populated programmatically with files from a java app in Google Cloud. It turns out that the individual files do not have ANY permissions for other than me as a user. I am running the java app from my IntelliJ IDE. Not sure why the permissions are so narrow. And not sure who the user is when the IDE runs.
It turns out that all of the individual files in the folder do not have ANY permissions for users other than me. As such the folder itself is not readable.
I am running the java app to read the directory and files from my IntelliJ IDE. I am not sure who the user is when the IDE runs.
But I am not sure why the permissions are so narrow. The folder is populated programmatically with files from a java app running in Google Cloud.
What controls the file permissions?
Here are code excerpts:
DbxClientV2 client = getDbxClientV2( );
try ( InputStream in = new ByteArrayInputStream( fileBytes ) ) {
FileMetadata metadata
= client.files( )
.uploadBuilder( filePath )
.uploadAndFinish( in );
///…
}
public DbxClientV2 getDbxClientV2( ) {
String accessToken = this.getAccessToken( );
DbxRequestConfig config
= DbxRequestConfig
.newBuilder( this.getAppIdentifier( ) )
.build( );
DbxClientV2 client = new DbxClientV2( config, accessToken );
return client;
}
@BruceVWilcox, file permissions are controlled by the user locally. Once the Dropbox app is installed and syncing is allowed, that user should have access to the contents of that Dropbox folder.
Have you confirmed the file or folder you are attempting to access exists with directory.exists()
function in your Java script?
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!