by josteink · 7y ago · 0 comments
I’ve often wanted this information but without having to rely on external book-keeping.
With Python 3.3+, which often is installed by default, you can use os.listxattr() and os.getxattr(). https://docs.python.org/3/library/os.html#linux-extended-att...
getfattr -d <downloaded file> mdls FILENAME
`kMDItemWhereFroms` is what you are looking for. And for a list of all the URLs from the current directory: mdls * | grep kMDItemWhereFroms -A 1 | grep http | ruby -ne "puts \$_.strip[1..-2]" xattr -l <downloaded file>