macos:admin:files
Table of Contents
Files
Special
- remove all
.DS_Storefiles below users home directorycd && find . -iname '.DS_Store' -a -not -ipath './Library/*' -delete 2>/dev/null
Flags
- show file flags:
ls -lO - add a flag:
sudo chflags <flag> <file>, withflag:hidden: hidden (for example~/Library);arch,archived: archived;nodump: ;opaque: ;sappnd,sappend: system append-only;schg,schange,simmutable: system immutable;uappnd,uappend: user append-only;uchg,uchange,uimmutable: user immutable;
- remove a flag:
sudo chflags no<flag> <file>
Attributes
- find all files having
quarantineattributesudo find / -user <user> -a -xattrname com.apple.quarantine 2>/dev/null
- remove
quarantinefile attribute, recursivelysudo xattr -r -d com.apple.quarantine /path/to/dir
- show file attributes:
ls -l@
Tags
(Finder) file tags are coded as file attributes in Apple File System (APFS).
- find files having assigned a(ny) tag
mdfind 'kMDItemUserTags == "*"' mdls -name kMDItemUserTags <files> find . -xattrname com.apple.metadata:_kMDItemUserTags -print -exec mdls -name kMDItemUserTags '{}' ";" 2>/dev/null
- force deletion of tags from file (x)attributes
xattr -d com.apple.metadata:_kMDItemUserTags <files>
macos/admin/files.txt · Last modified: by Ralf Hoppe
