哪位熟悉find。

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

哪位熟悉find。

#1

帖子 eexpress » 2005-10-06 15:36

想要用find列出某个文件夹中的特定文件和目录。特定条件是修改时间是精确的“年月日时分秒”,其中秒在5秒上下范围。
比如tar x出去的文件。如果是没有总目录的,就会释放出很多文件和目录。想要简单的回收到一个总目录。
● 鸣学
nios
帖子: 46
注册时间: 2005-09-20 11:18

#2

帖子 nios » 2005-10-06 18:02

大概的用法我知道:

find 搜索路径 -name 文件名 -print

print是将你搜索出来的东西打印到屏幕上。。。。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#3

帖子 eexpress » 2005-10-06 18:10

没说中
● 鸣学
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#4

帖子 oneleaf » 2005-10-06 18:55

只备份一天前修改过的文件

find /var/www -type f -mtime -1 -print>/tmp/filelist.txt
tar -cz -T /tmp/filelist.txt -f /mnt/bak/www.tgz
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#5

帖子 eexpress » 2005-10-06 19:05

天的知道。没有更精确的。还是grep找日期算了。
● 鸣学
zhuzhzh
帖子: 265
注册时间: 2005-07-28 15:08

#6

帖子 zhuzhzh » 2005-10-07 21:11

先创建某个时间的文件file1
再创建某个时间的文件file2
(用touch -t 0510072110 file1)

然后

find path -newer file1 ! -newer file2 -exec ls -l {} \
无声胜有声
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#7

帖子 oneleaf » 2005-10-07 21:16

:o 不错
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#8

帖子 eexpress » 2005-10-07 22:03

哇。这个都想的出来。大师。
● 鸣学
头像
millenniumdark
论坛版主
帖子: 4159
注册时间: 2005-07-02 14:41
系统: Ubuntu 14.04 (Kylin)
联系:

#9

帖子 millenniumdark » 2005-10-11 19:42

zhuzhzh 写了:先创建某个时间的文件file1
再创建某个时间的文件file2
(用touch -t 0510072110 file1)

然后

find path -newer file1 ! -newer file2 -exec ls -l {} \
回复