Poszukalem w necie jeszcze dokladniej i znalazlem dwa skrypty w batchu ktore polaczone razem dadza efekt o jaki mi chodzi. Probowalem zrobic to sam ale ni jak nie chce mi wyjsc. Osobno skrypty dzialaja. Wklejam je ponizej. Moze znajdzie sie ktos, kto bedzie wiedzial jak to zrobic.
Kod:
@ECHO OFF
ECHO Random Names
ECHO Written By: Jason Faulkner
ECHO HowToGeek.com
ECHO.
ECHO.
REM Randomly renames every file in a directory.
SETLOCAL EnableExtensions EnableDelayedExpansion
REM 0 = Rename the file randomly.
REM 1 = Prepend the existing file name with randomly generated string.
SET PrependOnly=0
REM 1 = Undo changes according to the translation file.
REM This will only work if the file "__Translation.txt" is in the same folder.
REM If you delete the translaction file, you will not be able to undo the changes!
SET Undo=0
REM --------------------------------------------------------------------------
REM Do not modify anything below this line unless you know what you are doing.
REM --------------------------------------------------------------------------
SET TranslationFile=__Translation.txt
IF NOT {%Undo%}=={1} (
REM Rename files
ECHO You are about to randomly rename every file in the following folder:
ECHO %~dp0
ECHO.
ECHO A file named %TranslationFile% will be created which allows you to undo this.
ECHO Warning: If %TranslationFile% is lost/deleted, this action cannot be undone.
ECHO Type "OK" to continue.
SET /P Confirm=
IF /I NOT {!Confirm!}=={OK} (
ECHO.
ECHO Aborting.
GOTO :EOF
)
ECHO Original Name/Random Name > %TranslationFile%
ECHO ------------------------- >> %TranslationFile%
FOR /F "tokens=*" %%A IN ('DIR /A:-D /B') DO (
IF NOT %%A==%~nx0 (
IF NOT %%A==%TranslationFile% (
SET Use=%%~xA
IF {%PrependOnly%}=={1} SET Use=_%%A
SET NewName=!RANDOM!-!RANDOM!-!RANDOM!!Use!
ECHO %%A/!NewName!>> %TranslationFile%
RENAME "%%A" "!NewName!"
)
)
)
) ELSE (
ECHO Undo mode.
IF NOT EXIST %TranslationFile% (
ECHO Missing translation file: %TranslationFile%
PAUSE
GOTO :EOF
)
FOR /F "skip=2 tokens=1,2 delims=/" %%A IN (%TranslationFile%) DO RENAME "%%B" "%%A"
DEL /F /Q %TranslationFile%
)
Ten skrypt zmienia nazwy wszystkich plikow w katalogu na nastepujaca postac: 2041-8596-24828.jpg, 3133-21275-25556.exe, 5532-22681-14865.txt itp.
Kod:
@Echo Off
Setlocal EnableDelayedExpansion
Set _RNDLength=1
Set _digits=0123456789
Set _Str=%_digits%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
Set _count=0
SET rnd_dgt=
:_loop
Set /a _count+=1
SET _RND=%Random%
Set /A _RND=_RND%%%_Len%
SET rnd_dgt=!rnd_dgt!!_digits:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
Echo Random string is !rnd_dgt!
Ten skrypt generuje losowa cyfre.
Kod:
@Echo Off
Setlocal EnableDelayedExpansion
Set _RNDLength=1
Set _letters=abcdefghijklmnopqrstuvwxyz
Set _Str=%_letters%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
Set _count=0
SET rnd_ltr=
:_loop
Set /a _count+=1
SET _RND=%Random%
Set /A _RND=_RND%%%_Len%
SET rnd_ltr=!rnd_ltr!!_letters:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
Echo Random string is !rnd_ltr!
Ten jest przerobka poprzedniego i generuje losowa litere.
I teraz caly myk polega na tym zeby do pierwszego skryptu dodac dwa pozostale i zastapic w nim linijke
Kod:
NewName=!RANDOM!-!RANDOM!-!RANDOM!!Use!
wynikami ze skryptow losujacych cyfry i litery zeby nazwa nowo powstalego pliku miala taka postac jak w pierwszym poscie.