List files recursively
Recursively lists non-directory files (i.e regular files, symbolic links, and hard links)
in directory specified by $DIR_ID (listing root).
Files are listed in lexicographical order by their paths, which are relative to the listing root directory.
If there is no access to the specified directory, its own relative path (".") will be included in the
inaccessiblePaths field and the listing result (i.e. files field) will be empty.
NOTE: the listing may contain files that are not fully synchronized or have been deleted in parallel.
For that reason, it's recommended to safeguard consecutive calls referring to the directory children
against ENOENT errors.
NOTE: since version 21.02.5, this endpoint accepts options as JSON body rather than in the query string. Moreover, some of the attributes have been renamed and the list of available ones has been extended. The old behaviour of the endpoint has been retained but is DEPRECATED and scheduled for deletion in the future major release. The following changes in attribute names were introduced:
file_id->fileIdmode->posixPermissionsparent_id->parentFileIdstorage_group_id->displayGidstorage_user_id->displayUidis_fully_replicated->isFullyReplicatedLocallyprovider_id->originProviderIdshares->directShareIdsowner_id->ownerUserIdhardlinks_count->hardlinkCount
Example cURL requests
List files recursively
curl -H "X-Auth-Token: $TOKEN" -H 'Content-type: application/json' \
-X GET "https://$PROVIDER_HOST/api/v3/oneprovider/data/$DIR_ID/files" -d '{
"start_after": "ParentDirName/Dir1",
"attributes": ["fileId", "path"]
}'
{
"files": [
{
"fileId": "FILE_ID1",
"path": "ParentDirName/Dir2"
},
{
"fileId": "FILE_ID2",
"path": "ParentDirName/File1.txt"
},
],
"inaccessiblePaths": [
"ParentDirName/Dir3"
],
"isLast": false,
"nextPageToken": "$PAGING_TOKEN"
}
Path parameters
| Parameter | Type & Description |
|---|---|
| id required | string Id of the directory to be listed. |
Query parameters
| Parameter | Type & Description |
|---|---|
| legacy_options | string The old behaviour of the endpoint has been retained but is DEPRECATED and scheduled for deletion in the future major release. You may refer to the docs for 21.02.4, but it's recommended to use the new API with options as JSON body. |
Request body
| Property | Type & Description |
|---|---|
limit integer Specifies the maximum number of entries that can be returned in one result batch. If there are more files, they can be retrieved using options that specify a custom starting point ( | |
token string Determines the starting point for listing. The listing will start from the next page (batch) of entries which follows the page previously obtained along with the corresponding | |
start_after string Determines the starting point for listing - it will be started from the first file path lexicographically larger than the provided path. | |
prefix string Only files with paths that begin with this value will be listed. | |
attributes array of strings List of names of the attributes to be included in the result. For a shared file/directory accessed in public mode, only the following attributes are available: | |
Request Examples
oneprovider-rest-cli listFilesRecursively id=$FILE_ID limit=100 start_after=dir1/dir2/filename.txtResponses
The list of directory files and subdirectories.
| Property | Type & Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
files array of objects (FileAttributes) The list of files.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inaccessiblePaths array of strings Paths to directories that were not listed due to lack of access privileges. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isLast boolean (IsLast) Due to delays in synchronization between Oneproviders, the number of returned entries can be smaller than the requested limit, even though there are still some ensuing ones. The | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nextPageToken string (ListPageToken) A token in the listing response that can be passed in the consecutive request to start listing from the next page of entries. When end of list is reached, the token is returned with a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example
{
"files": [
{
"fileId": "00000CF4706775696423745F772D67686431633765446F4D76546D6...",
"index": "g2gDZAAKbGlzdF9pbmRleG0AAAAEbmFtZW0AAAAHdHJlZV9pZA",
"type": "REG",
"activePermissionsType": "posix",
"posixPermissions": "511",
"acl": [],
"name": "File1.txt@a47b8b7a04b197c6cd99581047b8b7ad",
"conflictingName": "File1.txt",
"path": "/space/Dir1/File1.txt",
"parentFileId": "000006CB66373686172654775696423333964323636616564636562...",
"displayGid": 1101841,
"displayUid": 1935313,
"atime": 1464958683054,
"mtime": 1464958683051,
"ctime": 1464958681054,
"size": 1024,
"isFullyReplicatedLocally": false,
"localReplicationRate": 0.8,
"originProviderId": "a47b8b7a04b197c6cd99581047b8b7ad",
"directShareIds": [
"1d24c36707d99197c6cd995810a43aca",
"6825604b0eb6a47b8b7a04b6369eb24d"
],
"ownerUserId": "b6b6a47b8b7a04b63a45604b07b8b7a2",
"hardlinkCount": 1,
"symlinkValue": null,
"hasCustomMetadata": true,
"effProtectionFlags": [
"data_protection",
"metadata_protection"
],
"effDatasetProtectionFlags": [
"data_protection"
],
"effDatasetInheritancePath": "direct_and_ancestor",
"effQosInheritancePath": "ancestor",
"aggregateQosStatus": "fulfilled",
"archiveRecallRootFileId": "000006431633765446F4D76546D6F47067D67686431633765446F4D76546D6....",
"xattr.key1": "value1",
"xattr.key2": null
}
],
"inaccessiblePaths": [
"Dir1/Dir3"
],
"isLast": false,
"nextPageToken": "g2gDZAAKbGlua190b2tlbmgCZAAMY2FjaGVkX3Rva2VuWgADY..."
}Invalid request.
| Property | Type & Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error object (ErrorJson) Object describing an error.
| |||||||||||||||||||||||||||
Example
{
"error": {
"id": "example",
"description": "This is an example error.",
"ctx": {
"timestamp": 1750762637248,
"serviceReleaseVersion": "25.0",
"serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
"serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
"serviceBuildVersion": "231-g8d26f953c3",
"service": "opw",
"onedataErrorsRevision": "ca3af8cb",
"module": "metadata_req",
"line": 45
}
}
}Forbidden request.
| Property | Type & Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error object (ErrorJson) Object describing an error.
| |||||||||||||||||||||||||||
Example
{
"error": {
"id": "example",
"description": "This is an example error.",
"ctx": {
"timestamp": 1750762637248,
"serviceReleaseVersion": "25.0",
"serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
"serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
"serviceBuildVersion": "231-g8d26f953c3",
"service": "opw",
"onedataErrorsRevision": "ca3af8cb",
"module": "metadata_req",
"line": 45
}
}
}Invalid path - file or directory not found.
| Property | Type & Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error object (ErrorJson) Object describing an error.
| |||||||||||||||||||||||||||
Example
{
"error": {
"id": "example",
"description": "This is an example error.",
"ctx": {
"timestamp": 1750762637248,
"serviceReleaseVersion": "25.0",
"serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
"serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
"serviceBuildVersion": "231-g8d26f953c3",
"service": "opw",
"onedataErrorsRevision": "ca3af8cb",
"module": "metadata_req",
"line": 45
}
}
}Internal server error.
| Property | Type & Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error object (ErrorJson) Object describing an error.
| |||||||||||||||||||||||||||
Example
{
"error": {
"id": "example",
"description": "This is an example error.",
"ctx": {
"timestamp": 1750762637248,
"serviceReleaseVersion": "25.0",
"serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
"serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
"serviceBuildVersion": "231-g8d26f953c3",
"service": "opw",
"onedataErrorsRevision": "ca3af8cb",
"module": "metadata_req",
"line": 45
}
}
}