Darwin is open source. I'm guessing you'll need to modify OS level things, a kernel extension, etc. and add this ability.
Or you could modify the dynamic-view tools you know (fs_usage
and/or lsof
), have them check if a file is being created, and append the process chain that created it into the Spotlight comment, etc.
I need to learn proper xattr usage.
Apparently, xattr has a "clear" (-c) command that can be applied using a wildcard (*), as follows,
xattr -cr *
This results in a recursive removal of all ._AppleDouble files from the current folder on down (the -r flag does recursive, while the -c flag clears them), thus making the process a trivial one line command.
This does not however clear out the .DS_Store files. For that, you can employ the good old "find" command:
find . -type f -name .DS_Store -delete
This will find and delete any .DS_Store files from the current directory on down (recursively).
Lastly, we can bring it all together in the form of an alias that is called upon by simply typing "xat" (put the following in your .bash_profile):
alias xat='find . -type f -name .DS_Store -delete && xattr -cr *'
Now just run "xat" on any directory and it'll strip those pesky resource forks and remove those irritating .DS_Store files from anything inside of it.
Best Answer
The following
xttar
command causes both the attribute names and corresponding values to be displayed, if any exist.You can also use the
ls
command:That said, the
... No such xattr: com.apple.quarantine
message is a non-fatal message, meaning there no real need to make it conditional, and if your goal is to remove thecom.apple.quarantine
extended attribute from a lot of files at once in a given directory, thencd
to the target directory and use the following command:The above one-liner will delete the
com.apple.quarantine
extended attribute off every file that has it and act as if the entire contents of the directory recursively were also specified (so that every file in the directory tree is acted upon), thats the-r
option, while not showing errors for files that don't have the target extended attribute. (That's what the2>/dev/null
does.)