在macOS终端中,"ls | mdls"命令仅适用于主目录 [英] In the macOS terminal, "ls | mdls" commands are only working for the home directory

查看:101
本文介绍了在macOS终端中,"ls | mdls"命令仅适用于主目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要在macOS上下载文件夹的所有添加日期元数据的列表.我从 http找到了以下代码(用于macOS终端) ://forums.ilounge.com/applescripts-itunes-mac/100189-mdls-command-tiger.html ,但仅适用于主目录.添加其他目录作为修饰符不起作用,并且使用cd不起作用.当我做这些事情时,它仍然返回主目录的结果.如何使它适用于我的下载"文件夹,还是应该采用其他方法?我也涉猎过AppleScript,如果那样的话.

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.

推荐答案

以下列出了所有日期:

mdls -name kMDItemDateAdded ~/Downloads/*

这篇关于在macOS终端中,"ls | mdls"命令仅适用于主目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆