attach
| Function | Lists, finds, deletes (to trash), or renames page attachments. |
| Options | attach rm / attach mv need -y / --yes unless -n / --dry-run. attach find takes -name GLOB, `-size +N[c |
| Limitations | Trash only — no purge and no upload. attach ls / rm / mv take a page or a space (a space means its homepage), not / and not a folder. Piped attach rm takes at most 100 paths. attach find uses the search index (may lag after uploads; archived spaces and pages you can’t see are omitted). |
Subcommands
Section titled “Subcommands”attach ls [PAGE]— list attachment names on the current page or onPAGE.attach find [PATH] [-name GLOB] [-size +N[c|k|M|G]] [-mtime +N|-N] [-ls | --format csv]— walk attachments recursively under a page, space, folder, or/(default.).attach rm -y NAME [PAGE]— move one named attachment to trash.attach find ... | attach rm -nthen| attach rm -y— trash the attachments thatattach findprinted (max 100).attach mv -y OLD NEW [PAGE]— rename an attachment on the page.
PAGE is optional when you are already cd’d to that page.
attach find
Section titled “attach find”Default output is one path per attachment (/Space/Page/file.pdf; homepage files show as /Space/file.pdf), so head, grep, sort, and attach rm work in a pipe.
-sizeis GNU-style:+Nlarger,-Nsmaller. The default unit is bytes;k,M,Gare powers of 1024 (c= bytes).-mtimeuses the attachment’s last version date (same day rules asfind -mtime).-namematches the file name (*/?).-lsprintsSIZE LAST_UPDATE vN MEDIA_TYPE "name" path.--format csvprintstype,id,title,media_type,size,version,last_update,space_key,page_id,page_path,path.
-ls and --format csv output can’t be piped to attach rm. Caps: 5000 results / 250 search pages. Use du for size totals per page.
Examples
Section titled “Examples”$ attach ls$ attach ls ./Runbook$ attach find$ attach find /DOCS -name '*.pdf'$ attach find . -size +1M$ attach find ./MySpace -mtime +365 -ls$ attach find --format csv$ attach find /DOCS -size +10M | attach rm -n$ attach rm -y screenshot.png$ attach mv -y old-name.pdf new-name.pdf ./RunbookRecipe: Find large or old attachments.