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

老子叫甜甜 提交于 2019-12-08 09:23:28

问题


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 home directory. Adding a different directory as a modifier doesn't work, and using cd doesn't work. When I do those things, it still returns the results of the home directory. How do I get it to work for my Downloads folder, or is there another approach I should take? I've dabbled in AppleScript also if that is superior.

ls | mdls -name kMDItemDateAdded *

There is a similar question at Recursive file list of all files, list containing path+name, type, size, creation data, modification date, but I am not knowledgable enough to see if I can adapt it to my purposes.


回答1:


The following lists all dates:

mdls -name kMDItemDateAdded ~/Downloads/*



来源:https://stackoverflow.com/questions/51622643/in-the-macos-terminal-ls-mdls-commands-are-only-working-for-the-home-direct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!