分页: 1 / 1
如何以每隔一个小时建立一个以时间命名的文件夹
发表于 : 2010-05-14 18:43
由 525141335
如何以每隔一个小时建立一个以时间命名的文件夹?
刚学shell
希望各位大哥指点!
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
发表于 : 2010-05-14 19:12
由 tyro
crontab?
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
发表于 : 2010-05-15 0:09
由 525141335
pocoyo 写了:
crontab?

具体如何写,能否详细,谢谢你们!
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
发表于 : 2010-05-15 0:51
由 kamui0523
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
Re: 如何以每隔一个小时建立一个以时间命名的文件夹
发表于 : 2010-05-15 1:48
由 525141335
525141335 写了:pocoyo 写了:
crontab?

具体如何写,能否详细,谢谢你们!
我知道了,是用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鸟!
应该没错吧,我先试一下