Linux重命名文件,仅带有时间/日期戳 [英] Linux Rename file with only time/date stamp
本文介绍了Linux重命名文件,仅带有时间/日期戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只有一个文件,想要将mv重命名为year_month_day_h:m:s-最好的方法是什么?
I have a single file which I want to rename mv to year_month_day_h:m:s - whats the best way to do that?
我尝试了以下操作,但它没有动态添加正确的图章(原始文件的名称中实际上带有反斜杠):
I've tried the following but it doesn't dynamically add the correct stamp (original file actually has a backslash in the name):
mv getnw/myfilename.txt "%Y%m%d%H%M%S".txt
mv getnw/myfilename.txt "%Y-%m%d%H%M%S".txt
mv getnw/myfilename.txt %Y-%m%d%H%M%S.txt
mv getnw/myfilename.txt "'date +%Y%m%d%H%M%S'.txt"
mv getnw/myfilename.txt "%Y%m%d%H%M%S".txt
mv getnw/myfilename.txt "%Y-%m%d%H%M%S".txt
mv getnw/myfilename.txt %Y-%m%d%H%M%S.txt
mv getnw/myfilename.txt "'date +%Y%m%d%H%M%S'.txt"
推荐答案
mv myfile.txt `date +%Y_%m_%d_%H:%M:%S`.txt
这篇关于Linux重命名文件,仅带有时间/日期戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文