Delete a file or folder
Deletes a file or folder. Identify the item by ID or path in the WITH clause. This action cannot be undone.
DELETE FROM Files
WITH (
DriveId='me'
--OR--
--DriveId='b!GtLN726LE0eY5F2BBNi14'
--Enter file path or ID
--,ItemId='root:/dump.pdf:' --Path must end with colon
--,ItemId='root:/myfolder/dump.pdf:'
--,ItemId='01SUOJPKHXMPKD2UXXXXXXXXXXXXXXXXXX'
)
--Using Table Name instead of endpoint (with Id / Path in WHERE clause for simple Syntax)
--************
--Delete File by ID or Path
--************
--DELETE From Files Where Id='01N3NI7YU6DYBSLCEDKBB23CR4FSWZYSDJ'
--DELETE From Files Where Id='root:/test_out.csv:'
--DELETE From Files Where Id='root:/somefolder/test_out.csv:'
--************
--Delete Folder by ID or Path
--************
--DELETE From Folders Where Id='01N3NI7YU6DYBSLCEDKBB23CR4FSWZYSDJ'
--DELETE From Folders Where Id='root:/somefolder:'
--DELETE From Folders Where Id='root:/somefolder/childfolder:'
--DriveId can be retrieved by selecting from 'list_drives' endpoint.
--FileId can be retrieved by selecting from 'list_folder' or 'list_root' endpoints.