Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: название созданной папки копируется в буфер 
Author Message
Tol!k



PostPosted: Sun May 24, 2009 18:45    Post subject: Reply with quote

Повесь этот .cmd на кнопку с параметром %N.
Устанавливай курсор на папку и жми кнопку.
Code:
@echo off &chcp 1251 >nul
setlocal enableextensions

echo Переименовывает все файлы в директории под курсором по маске
echo [Название директории]_[Счётчик].ext
rem Параметры кнопки: %N
rem Автор: Tol!k

if exist %tmp%\~pd~c~.tmp exit

dir "%~1" /a-d/b/o:n >%tmp%\~pd~c~.tmp &cd "%~1"

for /f "delims=" %%f in (%tmp%\~pd~c~.tmp) do call:n "%~1" "%%~nf" %%~xf

cd .. &del /q %tmp%\~pd~c~.tmp &exit

:n
if /i "%~1%3"=="%~2%3" (goto:eof) else (
  for /l %%c in (2,1,999) do if /i "%~1_%%c%3"=="%~2%3" goto:eof
)
if /i not exist "%~1%3" (ren "%~2%3" "%~1%3" &goto:eof) else (
  for /l %%c in (2,1,999) do if /i not exist "%~1_%%c%3" (ren "%~2%3" "%~1_%%c%3" &goto:eof)
)
Надеюсь, в папке не больше 1000 файлов каждого расширения.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group