当前位置: 技术问答>linux和unix
aix下删除某个日期前的文件
来源: 互联网 发布时间:2017-01-06
本文导语: 在aix下,我要删除当前目录下的2009年5月1日前的,扩展名为.html的文件,shell命令如何写?谢谢 | [root@bache ~]# find tmp -name '*.c' ! -newermt 2009-05-15 | xargs ls -l -rw-r--r-- 1 root root 10977 2009-05-14 10:51 tmp/l...
在aix下,我要删除当前目录下的2009年5月1日前的,扩展名为.html的文件,shell命令如何写?谢谢
|
[root@bache ~]# find tmp -name '*.c' ! -newermt 2009-05-15 | xargs ls -l
-rw-r--r-- 1 root root 10977 2009-05-14 10:51 tmp/log.c
-rw-r--r-- 1 root root 365 2009-05-11 10:01 tmp/test.c
[root@bache ~]#
如上,其中目录为 ./tmp。貌似改成如下:
# find tmp -name '*.html' ! -newermt 2009-05-01 | xargs rm -f
|
[root@RHEL4_U5 ~]# find . -ctime 5
./.gnome2/accels
./.gnome2/accels/hwbrowser
./.gconfd
./.gconfd/saved_state
./test.sh
./test3.sh
./.gconf
./test2.sh
./temp.txt
./.gnome2_private
./manifold
[root@RHEL4_U5 ~]# stat test.sh
File: `test.sh'
Size: 71 Blocks: 16 IO Block: 4096 regular file
Device: 803h/2051d Inode: 1486855 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2009-05-09 20:36:18.000000000 +0800
Modify: 2009-05-04 05:54:13.000000000 +0800
Change: 2009-05-04 05:54:13.000000000 +0800
[root@RHEL4_U5 ~]# find . -ctime 5 -exec rm -fr {} ;
find: ./.gnome2/accels: No such file or directory
find: ./.gconfd: No such file or directory
find: ./.gconf: No such file or directory
find: ./.gnome2_private: No such file or directory
[root@RHEL4_U5 ~]# ls
1.sh autotel.sh Desktop install.log.syslog mysql.sh timetest
anaconda-ks.cfg bc.sh install.log minicom.log test_the_time txt
[root@RHEL4_U5 ~]# find . -ctime 5
[root@RHEL4_U5 ~]#
能看懂吗??如果不能看懂在我空间留言。。。我帮你解释。。。不过应该没问题了
./.gnome2/accels
./.gnome2/accels/hwbrowser
./.gconfd
./.gconfd/saved_state
./test.sh
./test3.sh
./.gconf
./test2.sh
./temp.txt
./.gnome2_private
./manifold
[root@RHEL4_U5 ~]# stat test.sh
File: `test.sh'
Size: 71 Blocks: 16 IO Block: 4096 regular file
Device: 803h/2051d Inode: 1486855 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2009-05-09 20:36:18.000000000 +0800
Modify: 2009-05-04 05:54:13.000000000 +0800
Change: 2009-05-04 05:54:13.000000000 +0800
[root@RHEL4_U5 ~]# find . -ctime 5 -exec rm -fr {} ;
find: ./.gnome2/accels: No such file or directory
find: ./.gconfd: No such file or directory
find: ./.gconf: No such file or directory
find: ./.gnome2_private: No such file or directory
[root@RHEL4_U5 ~]# ls
1.sh autotel.sh Desktop install.log.syslog mysql.sh timetest
anaconda-ks.cfg bc.sh install.log minicom.log test_the_time txt
[root@RHEL4_U5 ~]# find . -ctime 5
[root@RHEL4_U5 ~]#
能看懂吗??如果不能看懂在我空间留言。。。我帮你解释。。。不过应该没问题了
|
find /arch -name "*.html" -type f ! -newerct "20090501" -exec rm {} ;