Jos*_*kin 2 bash find positional-operator find-util
今天说是4月8日,我在bash中执行以下操作.
cd /tmp
mkdir hello
touch -d 2015-04-01 hello
Run Code Online (Sandbox Code Playgroud)
然后,假设我要删除/ tmp中超过一天的所有文件,但不删除目录,我执行此操作:
find /tmp -mtime +1 -delete -type f
Run Code Online (Sandbox Code Playgroud)
如果目录"hello"不是文件,为什么会删除?
谢谢!
find命令按顺序执行表达式.既然-delete是之前-type,-type从未达到.尝试:
find /tmp -mtime +1 -type f -delete
Run Code Online (Sandbox Code Playgroud)