How to use --max-depth option in remote api mode?

Hello Experts,

I have a need to list and copy files of specific pattern at one specific dir level and excluding sub directory files.

I tried with '--max-depth' option and it worked fine for command line mode.

But as I use rclone in remote mode, I am trying the same in api request but thats not working for me -

api - http://localhost:5572/operations/list
request -
{
"fs": "awso9dl:",
"remote": "o9datalake/storehere_MH",
"_filter": {
"IncludeRule": [
"DelimiterDimenDiv*.csv"
]
},
"opt": {
"filesOnly": true,
"recurse": true,
"maxDepth": 1
}
}

Response:
{
"list": [
{
"Path": "o9datalake/storehere_MH/DelimiterDimenDivya.csv",
"Name": "DelimiterDimenDivya.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/one/DelimiterDimenDivya.csv",
"Name": "DelimiterDimenDivya.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/one/DelimiterDimenDivya_copyfile.csv",
"Name": "DelimiterDimenDivya_copyfile.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/one/DelimiterDimenDivya_mh1.csv",
"Name": "DelimiterDimenDivya_mh1.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/one/DelimiterDimenDivya_mh2.csv/DelimiterDimenDivya_mh1.csv",
"Name": "DelimiterDimenDivya_mh1.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/one/DelimiterDimenDivya_mh3.csv/DelimiterDimenDivya_mh1.csv",
"Name": "DelimiterDimenDivya_mh1.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/six/DelimiterDimenDivya.csv",
"Name": "DelimiterDimenDivya.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/six/DelimiterDimenDivya_copyfile.csv",
"Name": "DelimiterDimenDivya_copyfile.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/six/DelimiterDimenDivya_mh1.csv",
"Name": "DelimiterDimenDivya_mh1.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/six/DelimiterDimenDivya_mh2.csv/DelimiterDimenDivya_mh1.csv",
"Name": "DelimiterDimenDivya_mh1.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
},
{
"Path": "o9datalake/storehere_MH/six/DelimiterDimenDivya_mh3.csv/DelimiterDimenDivya_mh1.csv",
"Name": "DelimiterDimenDivya_mh1.csv",
"Size": 239,
"MimeType": "application/octet-stream",
"ModTime": "2023-12-14T12:29:26.644000000+05:30",
"IsDir": false,
"Tier": "STANDARD"
}
]
}

I want to list/copy only the matching files at "o9datalake/storehere_MH" not the sub-directories.

Am I missing anything or any other way to achieve this?

Thanks in advance
Mahendra

@ncw @ @kapitainsky @asdffdsa

As per docs:

operations/list: List the given remote and path in JSON format

This takes the following parameters:

fs - a remote name string e.g. "drive:"
remote - a path within that remote e.g. "dir"
opt - a dictionary of options to control the listing (optional)
    recurse - If set recurse directories
    noModTime - If set return modification time
    showEncrypted - If set show decrypted names
    showOrigIDs - If set show the IDs for each item if known
    showHash - If set return a dictionary of hashes
    noMimeType - If set don't show mime types
    dirsOnly - If set only show directories
    filesOnly - If set only show files
    metadata - If set return metadata of objects also
    hashTypes - array of strings of hash types to show if showHash set

no MaxDepth here.. It is part of main hence use:

rclone rc options/set --json '{"main": {"MaxDepth": 1}}'

You can see all options' definitions by running:

rclone rc options/info

Do not assume where any option belongs without consulting documentation.

Would be assume if you used the help and support template and didn't randomly tag people.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.