gnu-findutils

GNU find: when does the default action apply?

♀尐吖头ヾ 提交于 2020-01-01 11:39:01
问题 The man page of Debian 8's find command says: If the whole expression contains no actions other than -prune or -print, -print is performed on all files for which the whole expression is true. So why do these outputs differ: $ mkdir -p test/foo test/bar && cd test && touch foo/bar bar/foo $ # Test 1 $ find . -name foo -type d -prune -o -name foo ./foo ./bar/foo $ # Test 2 $ find . -name foo -type d -prune -o -name foo -print ./bar/foo So test 1: does the expression contain "no actions other

How to find files modified in last x minutes (find -mmin does not work as expected)

社会主义新天地 提交于 2019-12-18 10:32:48
问题 I'm trying to find files modified in last x minutes, for example in the last hour. Many forums and tutorials on the net suggest to use the find command with the -mmin option, like this: find . -mmin -60 |xargs ls -l However, this command did not work for me as expected. As you can see from the following listing, it also shows files modified earlier than 1 hour ago: -rw------- 1 user user 9065 Oct 28 23:13 1446070435.V902I67a5567M283852.harvester -rw------- 1 user user 1331 Oct 29 01:10

Combine file modified date and “grep” results through “find”, in one line

泄露秘密 提交于 2019-12-18 09:23:43
问题 We want to show each file's modified date and time when applying grep to selected files by the find command. The final result should look like: 2016-10-17 Mon 20:38:57 ./rest/47results.php: 5 :σχόλια, ιδέες facebook Running the following from 47test.php file: system('export TZ=":Europe/Athens"; find . -name "*.*" \ -not \( -path ./admin -prune \) \ -not \( -path ./people/languages -prune \) \ -not \( -path ./include -prune \) \ -type f -mmin -10 \ -printf "%TY-%Tm-%Td %Ta %TH:%TM:%TS %p\n" \

Unix find -mtime {a negative or postive value}

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 21:33:38
问题 What do find -mtime -4 and find -mtime +4 do? I cannot understand the examples given in the man page. 回答1: As per man page: -mtime n File’s data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation of file modification times. The argument to -mtime is interpreted as the number of whole days in the age of the file. -mtime +n means strictly greater than, -mtime -n means strictly less than. So in your case, -4 meaning less than 4

Combine file modified date and “grep” results through “find”, in one line

纵然是瞬间 提交于 2019-11-29 17:10:16
We want to show each file's modified date and time when applying grep to selected files by the find command. The final result should look like: 2016-10-17 Mon 20:38:57 ./rest/47results.php: 5 :σχόλια, ιδέες facebook Running the following from 47test.php file: system('export TZ=":Europe/Athens"; find . -name "*.*" \ -not \( -path ./admin -prune \) \ -not \( -path ./people/languages -prune \) \ -not \( -path ./include -prune \) \ -type f -mmin -10 \ -printf "%TY-%Tm-%Td %Ta %TH:%TM:%TS %p\n" \ -exec grep -HTni "σχόλια" {} + '); we get distinct lines printed for each modified file and each line :