I am finished all the missions to get to “Cloud Coder” but “Get file count using API”. I am using the following code but the mission won’t complete:
Backendless.shared.file.getFileCount(path: "web", pattern: "*.html", recursive: true, responseHandler: { filesCount in
print("Files count = \(filesCount)")
}, errorHandler: { fault in
print("Error: \(fault.message ?? "")")
})
Any help would be appreciated. Thanks.
Hello @Michael_Wildermuth,
According to the mission description
This task will be marked as complete when you use the Get File Count Codeless block.
Please use Codeless instead of Swift API.
Regards,
Olha
Hi @olhadanylova,
Not sure where you are reading that, here is a cut and paste of the mission:
" With this task you will be using the API to get a count of files matching a pattern.
This task will be marked as complete when you use the Get File Count
API. You must use the *.html
pattern. The count must be obtained for the web
directory and calculated recursively
.
See the directory listing API documentation for details:
[JS API] [Android API] [iOS API] [Flutter API] [.NET API] [REST API]
Below is a sample code (in JavaScript) demonstrating the usage of the API"
Backendless.Files.getFileCount('web', '*.html', true)
.then(filesCount => console.log('Files count: ', filesCount))
.catch(error => console.log('Error: ', error.message))
Using Codeless worked but the instructions above don’t state to use it. Thanks though.