Dropbox API v2 Android - How to list files inside a sub-directory - dropbox-api

My AppFolder contains two sub-directories: Folder1, Folder2.
Each of the folders (Folder1, Folder2) has a bunch of files inside. I wanted to get a list of the files inside each of the sub-directories.
How do I check if Folder 1 for example contains files inside it?

Use like below:
result = client.files().listFolder("/Folder1");
System.out.println(result.getEntries().size()); // Should be != 0
The documentation is here :
https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/files/FileMetadata.html

Related

retrieve all files in subfolders in sharepoint document library using REST

I have a folder in a document library and that contains subfolders and each subfolder contains files.
I want to retrieve all the files in these subfolders using REST. I know how to get the files in each folder but is there any way to get all these files in one REST call... Any help?
You could use the below endpoint to retrieve all files in a library:
/_api/web/lists/getbytitle('Documents')/items?$expand=File&$select=File&$filter=FSObjType eq 0

PropertyManager2 iterates the tree for infinite depth for deleting/moving an IFile

I have a scenario, where I have around 10K files inside a folder named '_out'. and '_out' in-turn contains other folders and inner files and sub folders.
I'm deleting around 6000 files , which are directly present under the _out folder.
I delete the files by using the following code snippets:
for(IFile iFile:files){
iFile.delete(true, new NullProgressMonitor());
}
During the delete of each file, Property of each resource is being deleted, internally in the API Resource.deleteResource(boolean, MultiStatus), using method call to IPropertyManager.deleteResource(IResource). This API in-turn calls PropertyManager2.deleteProperties(IResource, int depth) with INFINITE depth and hence, all the folder and sub-folders inside the location "\workspace.metadata.plugins\org.eclipse.core.resources.projects\projectName.indexes\8f" are visited and 'Properties.index' files are loaded in each folder and then, checked whether the given IFile has a property in them. Where '8f' folder represents the Bucket for the '_out' folder.
for all the 6000 files, this operation is being repeated and hence, it takes around 15 minutes to delete all the 6000 files.
Ideally, should we just visit the properties.index file under the '8f' and delete the property for the given file and return?
My assumption is that the Properties for any files present directly under the '_out' folder will be saved under the 'properties.index' file in the Bucket corresponding to '_out' folder. (in my scenario 8f folder).
Apologies, if I have misunderstood it. Kindly, clarify.
I have raised a bug for the same at link.
Thanks,
Palraj

How to get the uploaded file path in FilePicker

Currently we are able to drag and drop the folders and we are able to get all the files in the folder.
but we are not able to get the path of that files.
How can we get the file path of the files which are uploaded, so that we can maintain the same folder structure ?
In response from filepicker you receive list of objects.
Each object looks like this:
{
"url":"https://www.filepicker.io/api/file/0SIihoHPT8ORvwQ3EOPx",
"filename":"filepicker_test.png",
"mimetype":"image/png",
"size":4607,
"id":4,
"path":"/2/folder/filepicker_test.png",
"isWriteable":true
}
So you can restore directories structure using "path" key from filepicker answer.

How to list out all the files in the public/images directory in a Play Framework 2 Scala application?

I want to list out all the file names in the public/images directory for my Scala Play Framework 2 application so that the Play Application just lists those file names to the HTML page. How can this be done?
Is there a right way to access the public/images directory to read files or list the directory? I don't want to use absolute directory paths.
There is method getFile(relateivePath: String): File on Play object and also in the Application class which returns file relative to application root directory. In your case:
Play.getFile("public/images")
return File object, which represent public/images/directory. You can call list or listFiles on it to get contents of the directory.

verify folder content

I've
resDir = C:\temp\source\
--------\folder1
--------\folder2
--------\file.txt
%list the content of resDir
list = ls(resDir);
and I want to check that resDir contains folder1 and folder2 and that they are not empty
is there an equivalent of contains(java) or exist function ?
thanks
Use EXIST function to detect if a particular folder exists.
Function DIR returns structure array of all objects in the directory. Empty folder will contain only 2 objects: . (current directory) and .. (root directory).
resDir = 'C:\temp\source\';
folder = 'folder1';
folderfull = fullfile(resDir,folder); %# full path to the folder
if exist(folderfull,'dir')
foldercontent = dir(folderfull);
if numel(foldercontent) > 2
%# folder exists and is not empty
end
end
I don't think that there is a built-in equivalent of the Java function you refer to, but Matlab provides all the basics you need to write your own without too much difficulty. Hit the documentation for isdir, fileparts, etc.