[{"data":1,"prerenderedAt":827},["ShallowReactive",2],{"navigation_docs":3,"-sdk-folders":223,"-sdk-folders-surround":822},[4,30,83,128,157,182],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Getting Started","\u002Fgetting-started","1.getting-started",[9,13,17,21,25],{"title":10,"path":11,"stem":12},"What is FlashDrive?","\u002Fgetting-started\u002Fwhat-is-flashdrive","1.getting-started\u002F01.what-is-flashdrive",{"title":14,"path":15,"stem":16},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F02.quickstart",{"title":18,"path":19,"stem":20},"Key concepts","\u002Fgetting-started\u002Fkey-concepts","1.getting-started\u002F03.key-concepts",{"title":22,"path":23,"stem":24},"Find files","\u002Fgetting-started\u002Ffind-files","1.getting-started\u002F04.find-files",{"title":26,"path":27,"stem":28},"Common use cases","\u002Fgetting-started\u002Fuse-cases","1.getting-started\u002F05.use-cases",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Platform Guide","\u002Fplatform","2.platform",[35,39,43,47,51,55,59,63,67,71,75,79],{"title":36,"path":37,"stem":38},"Organizations and workspaces","\u002Fplatform\u002Forganizations-and-workspaces","2.platform\u002F01.organizations-and-workspaces",{"title":40,"path":41,"stem":42},"Members, invitations, and roles","\u002Fplatform\u002Fmembers-and-roles","2.platform\u002F02.members-and-roles",{"title":44,"path":45,"stem":46},"API keys and permissions","\u002Fplatform\u002Fapi-keys","2.platform\u002F03.api-keys",{"title":48,"path":49,"stem":50},"Drives and the default drive","\u002Fplatform\u002Fdrives-and-defaults","2.platform\u002F04.drives-and-defaults",{"title":52,"path":53,"stem":54},"Folders and files","\u002Fplatform\u002Ffolders-and-documents","2.platform\u002F05.folders-and-documents",{"title":56,"path":57,"stem":58},"Upload files","\u002Fplatform\u002Fuploads-and-indexing","2.platform\u002F06.uploads-and-processing",{"title":60,"path":61,"stem":62},"Usage","\u002Fplatform\u002Fusage","2.platform\u002F07.usage",{"title":64,"path":65,"stem":66},"Billing and credits","\u002Fplatform\u002Fbilling","2.platform\u002F08.billing",{"title":68,"path":69,"stem":70},"Storage and limits","\u002Fplatform\u002Fstorage-and-upgrades","2.platform\u002F09.storage-and-upgrades",{"title":72,"path":73,"stem":74},"Account settings and security","\u002Fplatform\u002Faccount-and-security","2.platform\u002F10.account-and-security",{"title":76,"path":77,"stem":78},"Redeem a promo code","\u002Fplatform\u002Fpromo-codes","2.platform\u002F11.promo-codes",{"title":80,"path":81,"stem":82},"Build tools from files","\u002Fplatform\u002Ffile-workflows","2.platform\u002F12.file-workflows",{"title":84,"path":85,"stem":86,"children":87,"page":29},"SDK Guide","\u002Fsdk","4.sdk",[88,92,96,100,104,108,112,116,120,124],{"title":89,"path":90,"stem":91},"Python installation and configuration","\u002Fsdk\u002Finstallation","4.sdk\u002F01.installation",{"title":93,"path":94,"stem":95},"Upload your first files","\u002Fsdk\u002Fupload-files","4.sdk\u002F02.upload-files",{"title":97,"path":98,"stem":99},"Upload a large collection","\u002Fsdk\u002Fbulk-imports","4.sdk\u002F03.bulk-imports",{"title":101,"path":102,"stem":103},"Find, read and edit files","\u002Fsdk\u002Ffiles","4.sdk\u002F05.files",{"title":105,"path":106,"stem":107},"Work with folders","\u002Fsdk\u002Ffolders","4.sdk\u002F06.folders",{"title":109,"path":110,"stem":111},"Manage drives and defaults","\u002Fsdk\u002Fdrives-and-defaults","4.sdk\u002F07.drives-and-defaults",{"title":113,"path":114,"stem":115},"Replace files and attach metadata","\u002Fsdk\u002Freplace-and-label","4.sdk\u002F08.replace-and-label",{"title":117,"path":118,"stem":119},"Upload recovery and partial failures","\u002Fsdk\u002Fupload-recovery","4.sdk\u002F09.upload-recovery",{"title":121,"path":122,"stem":123},"Async workflows","\u002Fsdk\u002Fasync","4.sdk\u002F10.async",{"title":125,"path":126,"stem":127},"Errors, timeouts, and retries","\u002Fsdk\u002Ferrors-and-retries","4.sdk\u002F11.errors-and-retries",{"title":129,"path":130,"stem":131,"children":132,"page":29},"CLI Guide","\u002Fcli","5.cli",[133,137,141,145,149,153],{"title":134,"path":135,"stem":136},"Get Started","\u002Fcli\u002Fquickstart","5.cli\u002F01.quickstart",{"title":138,"path":139,"stem":140},"Profiles and Access","\u002Fcli\u002Fconfiguration","5.cli\u002F02.configuration",{"title":142,"path":143,"stem":144},"Uploads and Recovery","\u002Fcli\u002Fuploads-and-recovery","5.cli\u002F03.uploads-and-recovery",{"title":146,"path":147,"stem":148},"Mount and Sync","\u002Fcli\u002Fmount-and-sync","5.cli\u002F05.mount-and-sync",{"title":150,"path":151,"stem":152},"Sandbox Tokens","\u002Fcli\u002Fsandboxes","5.cli\u002F06.sandboxes",{"title":154,"path":155,"stem":156},"Command Reference","\u002Fcli\u002Fcommands","5.cli\u002F07.commands",{"title":158,"path":159,"stem":160,"children":161,"page":29},"MCP","\u002Fmcp","6.mcp",[162,166,170,174,178],{"title":163,"path":164,"stem":165},"Connect an AI client","\u002Fmcp\u002Fconnect","6.mcp\u002F01.connect",{"title":167,"path":168,"stem":169},"Choose an assistant’s permissions","\u002Fmcp\u002Fpermissions","6.mcp\u002F02.permissions",{"title":171,"path":172,"stem":173},"Upload and manage content","\u002Fmcp\u002Fmanage-content","6.mcp\u002F04.manage-content",{"title":175,"path":176,"stem":177},"Tool reference","\u002Fmcp\u002Ftools","6.mcp\u002F05.tools",{"title":179,"path":180,"stem":181},"Troubleshooting and revoking access","\u002Fmcp\u002Ftroubleshooting","6.mcp\u002F06.troubleshooting",{"title":183,"path":184,"stem":185,"children":186,"page":29},"Reference","\u002Freference","7.reference",[187,191,195,199,203,207,211,215,219],{"title":188,"path":189,"stem":190},"Authentication and API conventions","\u002Freference\u002Fauthentication","7.reference\u002F01.authentication",{"title":192,"path":193,"stem":194},"Organizations, workspaces, and access API","\u002Freference\u002Faccess-api","7.reference\u002F02.access-api",{"title":196,"path":197,"stem":198},"Drives, folders, and files API","\u002Freference\u002Fcontent-api","7.reference\u002F03.content-api",{"title":200,"path":201,"stem":202},"Uploads API","\u002Freference\u002Fuploads-api","7.reference\u002F04.uploads-api",{"title":204,"path":205,"stem":206},"Usage and billing API","\u002Freference\u002Fusage-and-billing-api","7.reference\u002F06.usage-and-billing-api",{"title":208,"path":209,"stem":210},"Errors and recovery","\u002Freference\u002Ferrors","7.reference\u002F07.errors",{"title":212,"path":213,"stem":214},"Limits and supported files","\u002Freference\u002Flimits","7.reference\u002F08.limits",{"title":216,"path":217,"stem":218},"Troubleshooting","\u002Freference\u002Ftroubleshooting","7.reference\u002F09.troubleshooting",{"title":220,"path":221,"stem":222},"Changelog","\u002Freference\u002Fchangelog","7.reference\u002F10.changelog",{"id":224,"title":105,"body":225,"description":815,"extension":816,"links":817,"meta":818,"navigation":819,"path":106,"seo":820,"stem":107,"__hash__":821},"docs\u002F4.sdk\u002F06.folders.md",{"type":226,"value":227,"toc":807},"minimark",[228,232,251,323,328,480,506,510,524,528,534,562,595,599,610,638,673,677,695,699,705,789,803],[229,230,231],"p",{},"These examples use the latest stable release of the Python SDK.",[229,233,234,238,239,242,243,246,247,250],{},[235,236,237],"code",{},"client.folders"," manages a drive's folders, which work like folders on a laptop: they nest up to 64 levels deep, and moving or renaming a folder keeps every file in it in place, with each file's ",[235,240,241],{},"path"," following. Every call takes ",[235,244,245],{},"drive_id"," (default: the client's drive, then the workspace default). The async client has the same calls; ",[235,248,249],{},"await"," each one.",[252,253,258],"pre",{"className":254,"code":255,"language":256,"meta":257,"style":257},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from flashdrive import Flashdrive\n\nwith Flashdrive() as client:\n    made = client.folders.ensure([\"reports\u002F2026\u002Fq3\", \"reports\u002F2026\u002Fq4\"])\n    q3 = made[0].id\n    client.folders.move(q3, None, name=\"third-quarter\")   # to the top level, renamed\n    for folder in client.folders.list():\n        print(folder.name, folder.id)\n    deletion = client.folders.delete(q3, recursive=True)  # the folder and everything in it\n    print(deletion.documents_deleted, deletion.state)\n","python","",[235,259,260,268,275,281,287,293,299,305,311,317],{"__ignoreMap":257},[261,262,265],"span",{"class":263,"line":264},"line",1,[261,266,267],{},"from flashdrive import Flashdrive\n",[261,269,271],{"class":263,"line":270},2,[261,272,274],{"emptyLinePlaceholder":273},true,"\n",[261,276,278],{"class":263,"line":277},3,[261,279,280],{},"with Flashdrive() as client:\n",[261,282,284],{"class":263,"line":283},4,[261,285,286],{},"    made = client.folders.ensure([\"reports\u002F2026\u002Fq3\", \"reports\u002F2026\u002Fq4\"])\n",[261,288,290],{"class":263,"line":289},5,[261,291,292],{},"    q3 = made[0].id\n",[261,294,296],{"class":263,"line":295},6,[261,297,298],{},"    client.folders.move(q3, None, name=\"third-quarter\")   # to the top level, renamed\n",[261,300,302],{"class":263,"line":301},7,[261,303,304],{},"    for folder in client.folders.list():\n",[261,306,308],{"class":263,"line":307},8,[261,309,310],{},"        print(folder.name, folder.id)\n",[261,312,314],{"class":263,"line":313},9,[261,315,316],{},"    deletion = client.folders.delete(q3, recursive=True)  # the folder and everything in it\n",[261,318,320],{"class":263,"line":319},10,[261,321,322],{},"    print(deletion.documents_deleted, deletion.state)\n",[324,325,327],"h2",{"id":326},"folder-calls","Folder calls",[329,330,331,344],"table",{},[332,333,334],"thead",{},[335,336,337,341],"tr",{},[338,339,340],"th",{},"Call",[338,342,343],{},"Result",[345,346,347,362,376,388,400,421,445,457,470],"tbody",{},[335,348,349,355],{},[350,351,352],"td",{},[235,353,354],{},"folders.list(parent_folder_id=None)",[350,356,357,358,361],{},"The direct child folders of ",[235,359,360],{},"parent_folder_id",", or of the top of the drive.",[335,363,364,369],{},[350,365,366],{},[235,367,368],{},"folders.get(folder_id)",[350,370,371,372,375],{},"A ",[235,373,374],{},"Folder",".",[335,377,378,383],{},[350,379,380],{},[235,381,382],{},"folders.create(name, parent_folder_id=None)",[350,384,385,386,375],{},"The new ",[235,387,374],{},[335,389,390,395],{},[350,391,392],{},[235,393,394],{},"folders.rename(folder_id, name)",[350,396,397,398,375],{},"The renamed ",[235,399,374],{},[335,401,402,407],{},[350,403,404],{},[235,405,406],{},"folders.move(folder_id, parent_folder_id, name=None)",[350,408,409,410,412,413,416,417,420],{},"The moved ",[235,411,374],{},", with its files and subfolders. ",[235,414,415],{},"None"," moves it to the top of the drive; ",[235,418,419],{},"name"," also renames it.",[335,422,423,428],{},[350,424,425],{},[235,426,427],{},"folders.ensure(paths)",[350,429,371,430,433,434,436,437,440,441,444],{},[235,431,432],{},"FolderPath"," (",[235,435,241],{}," and ",[235,438,439],{},"id",") for each of up to 500 paths such as ",[235,442,443],{},"\"reports\u002F2026\u002Fq3\"",". Folders that exist are reused, missing ones are created.",[335,446,447,452],{},[350,448,449],{},[235,450,451],{},"folders.delete(folder_id)",[350,453,454,455,375],{},"Deletes an empty folder and returns ",[235,456,415],{},[335,458,459,464],{},[350,460,461],{},[235,462,463],{},"folders.delete(folder_id, recursive=True, wait=True)",[350,465,466,467,375],{},"Deletes the folder and everything in it, and returns a ",[235,468,469],{},"FolderDeletion",[335,471,472,477],{},[350,473,474],{},[235,475,476],{},"folders.continue_deletion(deletion, wait=True)",[350,478,479],{},"Carries on a recursive deletion that has not finished.",[229,481,371,482,484,485,487,488,487,490,487,492,487,495,487,497,487,500,436,503,375],{},[235,483,374],{}," has ",[235,486,439],{},", ",[235,489,419],{},[235,491,360],{},[235,493,494],{},"version",[235,496,241],{},[235,498,499],{},"depth",[235,501,502],{},"created_at",[235,504,505],{},"etag",[324,507,509],{"id":508},"name-folders","Name folders",[229,511,512,513,515,516,519,520,523],{},"A folder name is 1 to 120 characters after trimming, never ",[235,514,375],{}," or ",[235,517,518],{},"..",", and has no ",[235,521,522],{},"\u002F"," or control characters. A whole folder path is at most 1,024 bytes. Two folders in the same parent cannot have the same name.",[324,525,527],{"id":526},"delete-a-folder-with-everything-in-it","Delete a folder with everything in it",[229,529,530,533],{},[235,531,532],{},"folders.delete(folder_id, recursive=True)"," removes the folder and all the folders and files inside it. The folders disappear at once and the files are deleted in steps.",[535,536,537,549],"ul",{},[538,539,540,541,544,545,548],"li",{},"With ",[235,542,543],{},"wait=True"," (the default), the call steps through the deletion until it finishes, for up to ",[235,546,547],{},"timeout"," (default 600 seconds).",[538,550,540,551,554,555,557,558,561],{},[235,552,553],{},"wait=False",", it returns the started ",[235,556,469],{},"; pass it to ",[235,559,560],{},"folders.continue_deletion(deletion)"," to carry on.",[229,563,371,564,484,566,487,569,433,572,515,575,578,579,487,582,436,585,588,589,591,592,594],{},[235,565,469],{},[235,567,568],{},"operation_id",[235,570,571],{},"state",[235,573,574],{},"running",[235,576,577],{},"finished","), ",[235,580,581],{},"folders_total",[235,583,584],{},"documents_total",[235,586,587],{},"documents_deleted",". If a file changes under a step, the SDK starts that step again. If a step still fails after three retries, the call raises the error; carry on later with ",[235,590,560],{}," and the ",[235,593,469],{}," the first call returned.",[324,596,598],{"id":597},"move-and-rename-files","Move and rename files",[229,600,601,602,605,606,609],{},"Files move and rename through ",[235,603,604],{},"client.documents",". Both calls need the ",[235,607,608],{},"latest_revision"," you read, so they never undo someone else's change:",[252,611,613],{"className":254,"code":612,"language":256,"meta":257,"style":257},"doc = client.documents.get(document_id)\nreceipt = client.documents.move(document_id, folder_id, expected_revision=doc.latest_revision)   # None: the top of the drive\n\ndoc = client.documents.get(document_id)\nclient.documents.rename(document_id, \"report.txt\", expected_revision=doc.latest_revision)\n",[235,614,615,620,625,629,633],{"__ignoreMap":257},[261,616,617],{"class":263,"line":264},[261,618,619],{},"doc = client.documents.get(document_id)\n",[261,621,622],{"class":263,"line":270},[261,623,624],{},"receipt = client.documents.move(document_id, folder_id, expected_revision=doc.latest_revision)   # None: the top of the drive\n",[261,626,627],{"class":263,"line":277},[261,628,274],{"emptyLinePlaceholder":273},[261,630,631],{"class":263,"line":283},[261,632,619],{},[261,634,635],{"class":263,"line":289},[261,636,637],{},"client.documents.rename(document_id, \"report.txt\", expected_revision=doc.latest_revision)\n",[229,639,640,641,644,645,647,648,651,652,655,656,515,658,660,661,663,664,667,668,672],{},"Both return a ",[235,642,643],{},"MutationReceipt"," with an ",[235,646,568],{}," you can follow with ",[235,649,650],{},"client.operations.get(receipt.operation_id)",". The file keeps its ID and ",[235,653,654],{},"external_id",". A file name is 1 to 255 bytes, not ",[235,657,375],{},[235,659,518],{},", with no ",[235,662,522],{},", backslash or control characters. If the file changed since your read, the call raises ",[235,665,666],{},"stale_version","; see ",[669,670,671],"a",{"href":114},"replace files"," for revision checks.",[324,674,676],{"id":675},"upload-into-folders","Upload into folders",[229,678,679,680,683,684,687,688,691,692,375],{},"Pass ",[235,681,682],{},"folder_id"," to ",[235,685,686],{},"client.upload()",". To copy a local folder tree, ",[235,689,690],{},"ensure"," its directory paths, then upload each directory's files with its folder ID, as shown in ",[669,693,694],{"href":98},"upload a large collection",[324,696,698],{"id":697},"folder-errors","Folder errors",[229,700,701,702,704],{},"Errors carry a ",[235,703,235],{}," to decide on:",[329,706,707,717],{},[332,708,709],{},[335,710,711,714],{},[338,712,713],{},"Code",[338,715,716],{},"Meaning",[345,718,719,729,743,753,763,780],{},[335,720,721,726],{},[350,722,723],{},[235,724,725],{},"invalid_name",[350,727,728],{},"The name breaks the rules above.",[335,730,731,736],{},[350,732,733],{},[235,734,735],{},"duplicate_name",[350,737,738,739,742],{},"A sibling folder already has that name (",[235,740,741],{},"details[\"name\"]","), or the destination already holds a file with that name.",[335,744,745,750],{},[350,746,747],{},[235,748,749],{},"folder_cycle",[350,751,752],{},"A move into the folder itself or one of its subfolders.",[335,754,755,760],{},[350,756,757],{},[235,758,759],{},"folder_too_deep",[350,761,762],{},"The result would be deeper than 64 levels or longer than 1,024 bytes.",[335,764,765,770],{},[350,766,767],{},[235,768,769],{},"folder_not_empty",[350,771,772,775,776,779],{},[235,773,774],{},"delete"," without ",[235,777,778],{},"recursive=True"," on a folder that holds files or folders.",[335,781,782,786],{},[350,783,784],{},[235,785,666],{},[350,787,788],{},"The folder or file changed since it was read. Read it again before retrying.",[229,790,791,792,794,795,798,799,802],{},"Every call also takes ",[235,793,547],{}," and, for changes, ",[235,796,797],{},"idempotency_key",". ",[235,800,801],{},"folders.ensure"," refuses more than 500 paths before sending anything, and the service also limits one call to 5,000 folder names in all.",[804,805,806],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":257,"searchDepth":270,"depth":270,"links":808},[809,810,811,812,813,814],{"id":326,"depth":270,"text":327},{"id":508,"depth":270,"text":509},{"id":526,"depth":270,"text":527},{"id":597,"depth":270,"text":598},{"id":675,"depth":270,"text":676},{"id":697,"depth":270,"text":698},"Create folder trees, move and rename folders and files, and delete a folder with everything in it.","md",null,{},{"title":105},{"title":105,"description":815},"e-01tNIWWnambHNWnJcL7Ne31QBUnfVite7HLEVxPTI",[823,825],{"title":101,"path":102,"stem":103,"description":824,"children":-1},"List and glob files, grep and read them by line, stream and download bytes, edit in place and follow changes.",{"title":109,"path":110,"stem":111,"description":826,"children":-1},"Create drives, choose where client calls run, and give a sandbox one drive.",1795366546182]