您好,我正在使用腻子,并尝试使用当前时间戳重命名文件名... 我已经使用以下命令重命名文件并根据日期 mv abc.log $(date +%F)prod.txt
Hello i'm using putty and trying to rename a file name with current time stamp ... I've used following Command to rename the files and according to date mv abc.log $(date +%F)prod.txt
以上命令已重命名但无法随时间重命名,其输出为:2014-05-12prodabc.log
above command renames but not able to rename with time, It giving Output as : 2014-05-12prodabc.log
以及以下命令 abc.log $(date +%y)$(date +%m)$(date +%d)abcprod.log
And following command abc.log $(date +%y)$(date +%m)$(date +%d)abcprod.log
将输出显示为:140512abc.log
giving output as : 140512abc.log
实际上我的要求如下.
rename abc.log to abc-current timestamp.log e.g abc.log become abc-12-05-2014-17:31.log then create new file abc.log请帮助,谢谢大家.
推荐答案您可以使用
mv test.dat test_$(date +%d-%m-%Y).dat如果您想知道如何控制输出,请查看手册页的日期.
If you want to know how you can control your output have a look at the date Manpages..
man date更多推荐
使用时间戳重命名UNIX中的文件命令
发布评论