更新时间:2023-02-21 11:07:24
查找/主页/测试-regextype POSIX扩展-regex'^ *测试\\ .LOG \\。[0 -9] {4} - [0-9] {2} - [0-9] {2} \\拉链'-mtime +3
-name
使用的球状的前pressions, -regex
找到
使用的扩展 -regextype POSIX扩展
标志表示\\。
+
为你的电话号码 -mtime +3
。 $找到。 -regextype POSIX扩展-regex'^ *测试\\ .LOG \\ [0-9] {4} - [0-9] {2} - [0-9] {2} \\拉链。
./test.log.1234-12-12.zip
I was trying to find all files dated and all files 3 days or more ago.
find /home/test -name 'test.log.\d{4}-d{2}-d{2}.zip' -mtime 3
It is not listing anything. What is wrong with it?
find /home/test -regextype posix-extended -regex '^.*test\.log\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.zip' -mtime +3
-name
uses globular expressions,
aka wildcards. What you want is
-regex
find
to use Extended
Regular Expressions via the
-regextype posix-extended
flag\.
+
as
in -mtime +3
.
$ find . -regextype posix-extended -regex '^.*test\.log\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.zip'
./test.log.1234-12-12.zip