我有数百个名为tutorial_xx.cpp
的文件,其中xx
是1到99之间的数字。我达到了三位数的标记,现在我必须更改所有文件编号,以便我可以跟踪时间顺序。我想,如果我可以在0
和tutorial_
之间添加xx.cpp
,我可以实现这一点,但显然这不起作用:
git mv tutorial_*.cpp tutorial_0*.cpp
是否有可能成功地在git中做这样的事情?如果是这样,怎么样?
如果在git-bash中,您可以尝试:
for name in tutorial_*.cpp;do
git mv $name ${name/_/_0/}
done
如果安装了Python,请尝试:
python -c "import os;map(lambda x:os.rename(x,x.replace('_','_0',1)),filter(lambda x:'tutorial_' in x, os.listdir('.')))"