1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| @echo off
REM --------------------------------------------------------
REM
REM Renommage des fichiers
REM
REM --------------------------------------------------------
set source=%C:\toto
for /F "tokens=1,2 delims=:" %%g in ('time/T') DO (set heure=%%gh%%h)
for /r "%source%" %%i in (*.*) do call :action "%%i" "%%~ni" "%%~xi"
:action
set control=%~1%
set nom_de_fichier=%~2%
set extension=%~3%
set var_last=%control:~-5,1%
IF NOT %var_last%==# ren "%control%" "%nom_de_fichier%-%date:~0,2%-%date:~3,2%-%date:~6,4%-%heure%%extension%"
REM --------------------------------------------------------
REM
REM Déplacer des fichiers
REM
REM --------------------------------------------------------
move /Y "C:\toto\toto1\*.txt" "C:\titi\toto1"
move /Y "C:\toto\toto2\*.txt" "C:\titi\toto2"
move /Y "C:\toto\toto3\*.txt" "C:\titi\toto3"
move /Y "C:\toto\toto4\*.txt" "C:\titi\toto4" |