如何以每隔一个小时建立一个以时间命名的文件夹?
刚学shell
希望各位大哥指点!
如何以每隔一个小时建立一个以时间命名的文件夹
-
- 帖子: 42
- 注册时间: 2009-03-14 0:18
- 来自: 广东技术师范学院
-
- 帖子: 111
- 注册时间: 2010-01-02 18:39
-
- 帖子: 42
- 注册时间: 2009-03-14 0:18
- 来自: 广东技术师范学院
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
具体如何写,能否详细,谢谢你们!pocoyo 写了:crontab?
-
- 帖子: 547
- 注册时间: 2008-05-14 18:53
- 来自: 上海
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
1.sudo /etc/init.d/cron start
2.crontab -e
3.select the editor which you familiar with
4.00 * * * * /bin/mkdir `date +%H:%M`
the directory name shows like as below
05:23
For print year,mouth and day,just relpace the setp 4 above with follow
00 * * * * /bin/mkdir `date +%y%m%d-%H:%M`
the directory name shows like as below
20100515-05:23
2.crontab -e
3.select the editor which you familiar with
4.00 * * * * /bin/mkdir `date +%H:%M`
the directory name shows like as below
05:23
For print year,mouth and day,just relpace the setp 4 above with follow
00 * * * * /bin/mkdir `date +%y%m%d-%H:%M`
the directory name shows like as below
20100515-05:23
-
- 帖子: 42
- 注册时间: 2009-03-14 0:18
- 来自: 广东技术师范学院
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
我知道了,是用crontab,具体如下:525141335 写了:具体如何写,能否详细,谢谢你们!pocoyo 写了:crontab?
1、新建一个crontab文档,如test,内容:* */1 * * * /home/hq/my.sh
2、在/home/hq/下建立一个shell ,my.sh,内容:mkdir /home/hq/`date +%Y-%m-%d_%H:%M:%S`
3、最后在终端执行:crontab /home/hq/test
这样就OK鸟!
应该没错吧,我先试一下