1

I have a folder containing over 2,000 web pages I've downloaded. Most of the file extensions are .html, though some are .pdf or .webarchive. My OS is Mojave.

When I highlight an icon in Finder, it lists a variety of metadata, including the source URL, the page title, author, and the date I downloaded it.

Is there a way to grab all that information - each file name, along with the source URL, page title, author and date downloaded - so I can put it in a Numbers spreadsheet?

I can do it manually, one file at a time, but that will take days.

6
  • The file's metadata can be seen in Terminal with the mdls command, see man mdls for more info. Also have a look at File Metadata Attributes Reference - Spotlight Metadata Attributes. E.g. mdls -name kMDItemAuthors -name kMDItemDownloadedDate -name kMDItemFSName -name kMDItemWhereFroms file ... You'd have to capture/process the output for each file parsing it into a usable format, e.g. a tab separated values file that could be opened in Numbers. – user3439894 Dec 22 '19 at 4:26
  • When you say "web pages I've downloaded", what exactly are you talking about. is it one file per page like in Safari saving a page is a web archive, filename.webarchive, or are taking about HTML pages, filename.html, or what exactly? Please be explicit and specific. Also, what version of macOS are you running? – user3439894 Dec 22 '19 at 8:41
  • Most of the file extensions are .html. However, some are .pdf or .webarchive. There are no image files. Also, I'm running Mojave OS. – David Blomstrom Dec 22 '19 at 9:17
  • The command mentioned in StarGeek's answer will handle the HTML and PDF files in the folder all at once but will not include Web Archives (.webarchive) as that file type is not supported in that manner. – user3439894 Dec 22 '19 at 9:55
  • 1
    Please don‘t include the answer into the question, post it below instead. – nohillside Dec 22 '19 at 12:20
2

ExifTool might be able to do it. You would need to extract them by name (see the MacOS tags page) or you could add the -api 'MDItemTags=1' option, as they are not extracted by default.

A command such as this will extract your tags and create a CSV file for you
exiftool -csv -filename -MDItemWhereFroms -MDItemTitle -MDItemAuthors -MDItemDownloadedDate /path/to/files >Outfile.csv

5
  • Unfortunately, I don't use a Mac so I can't verify how accurate the command might be, but it should be at least a starting point if you decide to use ExifTool. The author of ExifTool does use a Mac and could clarify any issues on the ExifTool forums. – StarGeek Dec 22 '19 at 5:17
  • Good tip; I'll give ExitTool a try. I stumbled across something called NeoFinder, but it is apparently designed to work primarily with images. – David Blomstrom Dec 22 '19 at 9:22
  • 1
    Wow, ExifTool is awesome! I edited my original post with more details. – David Blomstrom Dec 22 '19 at 11:47
  • Someone deleted my revision! Anyway, your command works if you delete each instance of "MDItem." However, WhereFroms and DownloadedDate don't work. I've tired -Where, -URL, -Source and -Date without success. – David Blomstrom Dec 22 '19 at 13:35
  • 1
    One more note...I've just learned that there are effectively no aliases that work for some types of metadata, including the source URL and date created. There is a command to extract ALL metadata, but it has its own problems - like three dozen columns of data to sort through. But this is a great tool for at least obtaining some metadata. – David Blomstrom Dec 22 '19 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .