|
Answer» Hello
i wanna ADD different values to file name (after and before)
before, i will select file types (rar - zip - dat)
val = Date, time, directory AddOn_words (i will add in to batch file)
directory1 = c:\Uk1\Ali directory2 = c:\NL\Stock directory3 = c:\NL\Veli and others... LAST directory name important on path
file name = Test-File1.rar
After File Names : format_1 = #FileName_#Directory__#Date
result 2 : Test-File1_Ali__22_08_2014.rar / Test-File1_Veli__22_08_2014.rar / Test-File1_Stock__22_08_2014.rar
format_2 = #FileName_#Directory__#Date__#Time
result 2 : Test-File1_Ali__22.08.2014__12_26.rar / Test-File1_Veli__22.08.2014__12_26.rar / Test-File1_Stock__22.08.2014__12_26.rar
format_3 = #FileName_#Directory__#Date_#Word (i will write value word in to batch file... example = Sales, Order, Wait)
result 3 : Test-FileXXX_Ali__22.00.2014_Order.rar / Test-FileXXXX_Veli__22.08.2014_Input.rar / Test-FileXXXX_Stock__22.08.2014_Input.rar
Before File Names: #Directory__#Date__#Time__#FileName : Ali__22.08.2014__12_26__Test-File1.rar / Veli__22.08.2014__12_26__Test-File1.rar / Stock__22.08.2014__12_26__Test-File1.rar #Directory__#Date__#FileName #Directory__#FileName #Date__#Time__#FileName
and others FORMATS....
i will change, i will create new/different formats for my files
how i can do ?
thank you very muchDo any filenames contain ! characters?
Are the files all in one single folder?Hello
before i am changing all different chars on file-names ! ' " , ... <>[]() your pre-batch files doing
what i do ?
have much files in directory before i will create format with bacth file and will CALL Format from directory, changes will execute in there
and.. i will change directory, will call different or same batch file for THAT Directory
yes... execute will be in one single folder, but folder name is variable
could you help me ?Will the date and time variables be fixed for a directory?
If you have dynamic date and time then each file could have a different time, or date if it is around midnight.when call the batch file.. time and date its examle... now 22_08_2014 (not . using _ ) ; 04_42 (not : and 24h)
when i change directory and call the batch file will insert that time and date (yes dynamic D-T)This will rename files like my file.txt to my file - foldername - date - time.txt
Test it in a folder with copies of your files first.
CODE: [Select]echo off for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set "d=YYYY%-%MM%-%DD%" set "t=%HH%-%Min%-%Sec%" for %%b in ("%cd%") do set "folder=%%~nxb"
for /f "delims=" %%a in ('dir /b /a-d ') do ( ren "%%a" "%%~na - %folder% - %d% - %t%%%~xa" )
pause
|