Skip to content

attach

FunctionLists, finds, deletes (to trash), or renames page attachments.
Optionsattach rm / attach mv need -y / --yes unless -n / --dry-run. attach find takes -name GLOB, `-size +N[c
LimitationsTrash 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).
  • attach ls [PAGE] — list attachment names on the current page or on PAGE.
  • 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 -n then | attach rm -y — trash the attachments that attach find printed (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.

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.

  • -size is GNU-style: +N larger, -N smaller. The default unit is bytes; k, M, G are powers of 1024 (c = bytes).
  • -mtime uses the attachment’s last version date (same day rules as find -mtime).
  • -name matches the file name (* / ?).
  • -ls prints SIZE LAST_UPDATE vN MEDIA_TYPE "name" path.
  • --format csv prints type,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.

$ 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 ./Runbook

Recipe: Find large or old attachments.