bat для переименования файлов в папке

  • Автор темы Автор темы sobak
  • Дата начала Дата начала
  • Теги Теги
    bat
Please write the renamer.bat file
renamer.bat is located in a folder with many directories.
renamer.bat sequentially goes into each directory and renames the files, adding the name of the directory they are in to the beginning of the name.
{
"script": "@echo off\nfor /d %%A in () do (\n cd %%A\n for %%F in () do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%%~nA\"\n set \"tag=!foldername!-\"\n if not \"!filename:~0,4!\"==\"!tag!\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!!datestamp!-%%F\"\n )\n )\n cd..\n)",
"description": "This .bat file script, renamer.bat, is located in a folder with multiple directories. It sequentially goes into each directory and renames the files, adding the name of the directory they are in to the beginning of the file name."
}
 
Назад
Сверху Снизу