开发者

find command characteristics on unix

开发者 https://www.devze.com 2023-02-21 09:48 出处:网络
How can I delete from directory2 and directory3 some files in the same time using the find command? Some files of directory1 valides the same characteristics of the files in the 2 others d开发者_如何

How can I delete from directory2 and directory3 some files in the same time using the find command?

Some files of directory1 valides the same characteristics of the files in the 2 others d开发者_如何学Pythonirectory and directories 1,2,3 figures in the directory0.


I suppose you meant:

(cd directory1 | find -iname 'somename' -print0) |
    tee >(cd directory2 && xargs -0 rm -fvi) |
    tee >(cd directory3 && xargs -0 rm -fvi)

ad libitum? But I'll make the answer more specific once you do your question


To find (From the man examples)

find / -newerct '1 minute ago' -print
             Print out a list of all the files whose inode change 
             time is more recent than the current time minus one minute

To remove

find / -newerct '1 minute ago' -print | xargs rm
0

精彩评论

暂无评论...
验证码 换一张
取 消