Skip to content

Instantly share code, notes, and snippets.

@horimislime
Last active December 16, 2015 07:09
Show Gist options
  • Save horimislime/5396517 to your computer and use it in GitHub Desktop.
Save horimislime/5396517 to your computer and use it in GitHub Desktop.
Example to list files downloaded from specific domain
import os
import xattr
watchdir="/Users/horimislime/Desktop/"
#search files downloaded from pixiv
domain='www.pixiv.net'
for file in os.listdir(watchdir):
try:
fullpath=os.path.join(watchdir,file)
if xattr.getxattr(fullpath,'com.apple.metadata:kMDItemWhereFroms').find(domain)> 0:
print fullpath
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment