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

  • Автор темы Автор темы sobak
  • Дата начала Дата начала
  • Теги Теги
    bat
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%~dp0\"\n set \"foldername=!foldername:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
use formatting
 
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%~dp0\"\n set \"foldername=!foldername:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
 
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%~dp0\"\n set \"foldername=!foldername:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
it's good, but use a line break
 
it's good, but use a line break
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%~dp0\"\n set \"foldername=!foldername:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
 
Please write a .bat file for windows 10 that renames files in the folder where this batch file is running. I need to add a tag, with the name of the folder where the file to be renamed is located, and the current date in ddmmyyyyyy format. For example: a file like "1530_co6aka.ts", which is in the folder "foldrnam", will be renamed to "foldrnam-11042024-1530_co6aka.ts". The date format should be in the form "ddmmyyyyyyy".

Also, this .bat file should not affect other files that already have this tag at the beginning.
 
Please write a .bat file for windows 10 that renames files in the folder where this batch file is running. I need to add a tag, with the name of the folder where the file to be renamed is located, and the current date in ddmmyyyyyy format. For example: a file like "1530_co6aka.ts", which is in the folder "foldrnam", will be renamed to "foldrnam-11042024-1530_co6aka.ts". The date format should be in the form "ddmmyyyyyyy".

Also, this .bat file should not affect other files that already have this tag at the beginning.
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%~dp0\"\n set \"foldername=!foldername:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyyyyy. It will not affect files that already have this tag at the beginning."
}
 
Please write a cmd/batch file for windows 10 that renames files in a folder. I need to add a tag, with the name of the folder where the file to be renamed is located, and the current date in ddmmyyyy format. For example: a file like "1530_co6aka.ts", which is in the folder "foldrnam", will be renamed to "foldrnam-11042024-1530_co6aka.ts". The date format should be in the form "ddmmyyyy".

Also, this .bat file should not affect other files that already have this tag at the beginning.
 
Please write a cmd/batch file for windows 10 that renames files in a folder. I need to add a tag, with the name of the folder where the file to be renamed is located, and the current date in ddmmyyyy format. For example: a file like "1530_co6aka.ts", which is in the folder "foldrnam", will be renamed to "foldrnam-11042024-1530_co6aka.ts". The date format should be in the form "ddmmyyyy".

Also, this .bat file should not affect other files that already have this tag at the beginning.
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"foldername=%~dp0\"\n set \"foldername=!foldername:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
 
Let's start at the beginning. Please write a .bat file for windows 10 that renames files. It works with files that are in the same folder with it. You need to add a tag with the folder name and the current date in "ddmmyyyy" format.
For example: a file like "1530_co6aka.ts" which is in the folder "babaka" will be renamed to "babaka-11042024-1530_co6aka.ts". The date format should be in the form "ddmmyyyy".

Also, this .bat file should not affect other files that already have this tag at the beginning.
 
Let's start at the beginning. Please write a .bat file for windows 10 that renames files. It works with files that are in the same folder with it. You need to add a tag with the folder name and the current date in "ddmmyyyy" format.
For example: a file like "1530_co6aka.ts" which is in the folder "babaka" will be renamed to "babaka-11042024-1530_co6aka.ts". The date format should be in the form "ddmmyyyy".

Also, this .bat file should not affect other files that already have this tag at the beginning.
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"folderpath=%~dp0\"\n set \"foldername=!folderpath:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
 
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"folderpath=%~dp0\"\n set \"foldername=!folderpath:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
It's okay, please use line breaks to make it easier to read.
 
It's okay, please use line breaks to make it easier to read.
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"folderpath=%~dp0\"\n set \"foldername=!folderpath:~0,-1!\"\n set \"tag=!foldername:~3!\"\n if not \"!filename:~0,12!\"==\"!tag!-\" (\n set \"datestamp=!date:~0,2!!date:~3,2!!date:~6,4!\"\n ren \"%%F\" \"!tag!-!datestamp!-%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
 
Please create a .bat file for windows 10 that renames files that are in the same folder as it.
It appends a tag to the file name with the folder name and the current date in the format "ddmmyyyyyy".
For example, a file like "1530_co6aka.ts" located in the "babaka" folder would be renamed to "babaka-11042024-1530_co6aka.ts". In this case, the tag added is "babaka-11042024-" at the beginning of the file name
Also, this .bat file should not affect other files that already have this tag at the beginning.
 
Please create a .bat file for windows 10 that renames files that are in the same folder as it.
It appends a tag to the file name with the folder name and the current date in the format "ddmmyyyyyy".
For example, a file like "1530_co6aka.ts" located in the "babaka" folder would be renamed to "babaka-11042024-1530_co6aka.ts". In this case, the tag added is "babaka-11042024-" at the beginning of the file name
Also, this .bat file should not affect other files that already have this tag at the beginning.
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"folderpath=%~dp0\"\n set \"foldername=!folderpath:~0,-1!\"\n set \"tag=!foldername:~3!-!date:~0,2!!date:~3,2!!date:~6,4!-\"\n if not \"!filename:~0,12!\"==\"!tag!\" (\n ren \"%%F\" \"!tag!%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
 
{
"script": "@echo off\nsetlocal enabledelayedexpansion\nfor %%F in (*) do (\n set \"filename=%%~nxF\"\n set \"extension=%%~xF\"\n set \"folderpath=%~dp0\"\n set \"foldername=!folderpath:~0,-1!\"\n set \"tag=!foldername:~3!-!date:~0,2!!date:~3,2!!date:~6,4!-\"\n if not \"!filename:~0,12!\"==\"!tag!\" (\n ren \"%%F\" \"!tag!%%F\"\n )\n)\nendlocal",
"description": "This .bat file script renames files in the folder where it is located. It adds a tag containing the folder name and the current date in the format ddmmyyyy. It will not affect files that already have this tag at the beginning."
}
all right, but don't use "script."
 
Please replace ABC in this script with the name of the file folder:


@echo off
setlocal enabledelayedexpansion

for %%F in (*) do (
set "filename=%%~nxF"
set "extension=%%~xF"

set "firstchars=!filename:~0,4!"

if not "!firstchars!"=="ABC-" (
if /I not "!extension!"==".bat" (
set "datestamp=!date:~0,2!!date:~3,2!!date:~6,4!"
ren "%%F" "ABC-!datestamp!-%%F"
)
)
)
 
Please replace ABC in this script with the name of the file folder:


@echo off
setlocal enabledelayedexpansion

for %%F in (*) do (
set "filename=%%~nxF"
set "extension=%%~xF"

set "firstchars=!filename:~0,4!"

if not "!firstchars!"=="ABC-" (
if /I not "!extension!"==".bat" (
set "datestamp=!date:~0,2!!date:~3,2!!date:~6,4!"
ren "%%F" "ABC-!datestamp!-%%F"
)
)
)
 
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.
 
@ChatGPT,
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.
 
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.
 
Назад
Сверху Снизу