Questions tagged [mdls]

mdls is a BSD command line tool that list the metadata attributes for a specified file.

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/mdls.1.html

10 questions
3
votes
1 answer

Change "date added" attribute of a file on OSX

I have been using Terminal to change the "date added" attribute of a file without success. What I'm doing is: Display the attributes of a file: mdls file_name Display the "date added" attribute: xattr -p "kMDItemDateAdded" file_name Change it: sudo…
user6877269
2
votes
1 answer

Parse error in globbing filenames containing dashes in zsh

When I run mdls -name kMDItemFSName -name kMDItemDateAdded -raw * in zsh in a folder containing the directory - Java Code, I get the following error: mdls: unrecognized option `- Java Code' How can I fix this? I tried using "*", but it didn't glob…
HappyFace
  • 3,439
  • 2
  • 24
  • 43
2
votes
1 answer

Does "$ mdls -recursive" exist?

Can the mdls command be used recursively in the macOS terminal? Is there an alternative that will get me a list of every file along with all the mdls info? ls has an option to get me some, but not nearly as many as mdls. This is a followup question…
1
vote
1 answer

Swift - How to modify file metadata like kMDItemDisplayName?

I'm trying to find a way to change a file's metadata attributes (those with the prefix of "kMDItem", listed by mdls), but I didn't find any solution for it. ToT At first, I've tried using FileManager.default.setAttributes(_attributes:ofItemAtPath:),…
AgentBilly
  • 756
  • 5
  • 20
1
vote
0 answers

MDLS | MetaData | Unable to grab kMDItemVersion of Illustrator File

I'm attempting to display a files version using mdls -name kMDItemVersion filepath but it's returning null. If I simpy run mdls filepath the kMDItemVersion is not displayed for the file. The weird part is that I can view the version info by…
PNW DC
  • 21
  • 3
1
vote
1 answer

Convert output of mdls to NSDictionary

Running BSD's metadata tool in Terminal on a CSV file ($ mdls foo.csv) will produce output like this: kMDItemContentCreationDate = 2014-08-27 15:28:16 +0000 kMDItemContentModificationDate = 2014-08-27 15:28:16 +0000 kMDItemContentType …
craig
  • 25,664
  • 27
  • 119
  • 205
0
votes
1 answer

How to search for keywords in metadata across all files in a folder recursively?

I need to search all subdirectories and files recursively from a location and print out any files that contains metadata matching any of my specified keywords. e.g. If John Smith was listed as the author of hello.js in the metadata and one of my…
user2989759
  • 279
  • 1
  • 4
  • 14
0
votes
1 answer

Is there a better way to determine if an os.popen output is "could not find" vs the intended output?

Good Afternoon I'm currently trying to create a script that uses os.popen to access the MacOS application folder, check the version of a program, and then output the version. If the program is not found, the program outputs "[program] is not…
0
votes
1 answer

In the macOS terminal, "ls | mdls" commands are only working for the home directory

I would like a list of all the date added metadata for my Downloads folder on macOS. I found the following code (for macOS terminal) from http://forums.ilounge.com/applescripts-itunes-mac/100189-mdls-command-tiger.html, but it only works for the…
0
votes
3 answers

Where is "Where from" in a macOS image stored?

Images downloaded from the web using Safari and macOS have information available from the Finder with Get Info. For example, "Where from" which can be the URL for the original image. Is that stored with the image or ? exiftool image.jpg doesn't show…
Greg
  • 2,359
  • 5
  • 22
  • 35