I'm have a lot of pictures in a file system. I'm trying to figure out a way to rename all of the files, and if possible put them in one folder. At the very least rename them where they are.
我在文件系统中有很多图片。我正试图想出一种方法来重命名所有文件,如果可能的话,将它们放在一个文件夹中。至少将它们重命名为它们所在的位置。
They are currently in a hierarchy like this:
它们目前处于以下层次结构中:
folder1\folder2\filename.jpg
Is there any way I can write a script to rename the files so the name of the actual file would be:
有没有办法我可以写一个脚本来重命名文件,所以实际文件的名称是:
folder1-folder2-filename.jpg
I'm not sure how to go about this. Any suggestions or a push in the right direction would be greatly appreciated.
我不知道该如何解决这个问题。任何建议或推动正确的方向将不胜感激。
1 个解决方案
#1
0
try this..
for %%* in (.) do set name=%%~pn*
set name=%name:\=-%
set name=%name:~1%
%name% now has the folder name. add this to your file name.
%name%现在具有文件夹名称。将其添加到您的文件名中。
#1
0
try this..
for %%* in (.) do set name=%%~pn*
set name=%name:\=-%
set name=%name:~1%
%name% now has the folder name. add this to your file name.
%name%现在具有文件夹名称。将其添加到您的文件名中。