|
Answer» Hello
i have much files in directory and i wanna trim file name --------------------------------------------------------- Ali_Veli_05_02_02_00001.log Ali_Veli_06_04_75_00002.log Ali_Veli_08_05_53_00003.log Ali_Veli_11_07_16_00010.log Ali_Veli_14_11_96_00012.log Ali_Veli_23_18_00_00034.log ---------------------------------------------------------
to.....
--------------------------------------------------------- exam 1: Ali_Veli_00001.log Ali_Veli_00002.log Ali_Veli_00003.log Ali_Veli_00010.log Ali_Veli_00012.log Ali_Veli_00034.log ---------------------------------------------------------
exam 2: Ali_Veli_1.log Ali_Veli_2.log Ali_Veli_3.log Ali_Veli_10.log Ali_Veli_12.log Ali_Veli_34.log ---------------------------------------------------------
2 exam different work for me
could you help me ?
thxHere's one way: there are two different scripts to rename the files. You can't rename the same set of files TWICE though.
This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.
CODE: [Select]echo off dir Ali_Veli_*.log /b /a-d |repl "(.*?_.*?_).*?_.*?_.*?_(.*\....)" "ren \q$&\q \q$1$2\q" x >renfiles.bat call renfiles.bat del renfiles.bat pause
Code: [Select]echo off dir Ali_Veli_*.log /b /a-d |repl "(.*?_.*?_).*?_.*?_.*?_[0]*(.*\....)" "ren \q$&\q \q$1$2\q" x >renfiles.bat call renfiles.bat del renfiles.bat pause
This will merely display the changes to the screen:
Code: [Select]echo off dir Ali_Veli_*.log /b /a-d |repl "(.*?_.*?_).*?_.*?_.*?_(.*\....)" "$1$2" dir Ali_Veli_*.log /b /a-d |repl "(.*?_.*?_).*?_.*?_.*?_[0]*(.*\....)" "$1$2" pause sorry.. my mistake for file names
Ali_Veli not standart on file name.. so sorry for it
different file names... Ali_Veli_05_02_02_00001.log HAsaOsman_Nejat_Bekir_Selim_08_09_02_00 001.log Cilek_a_06_02_01_00005.log a_99_11_74_10562.log akhkas_jhdk jhkj ha'skjhdkjah_cht_div_bat_08_09_02_00001.lo g
standart just right char count
all file name included this style "_xx_yy_zz_abcde"
i wanna modify _xx_yy_zz_abcde this number line
so sorry for my mistakeShow what you want to rename them to...
Your original post shows two different formats.wanna change file names with 2 FORMAT
mean.. i will use 2 batch file on my files for different works
--------------------------------------------------------- Ali_Veli_05_02_02_00001.log ===> format_1= Ali_Veli_00001.log ===> format_2 = Ali_Veli_1.log Hasan_06_04_75_00002.log ===> format_1= Hasan_00002.log ===> format_2 = Hasan_1.log Cilek_yesim_nihale_08_05_53_00003.log ===> format_1= Cilek_yesim_nihale_00003.log ===> format_2 = Cilek_yesim_nihale_3.log aa_11_07_16_00010.log ===> format_1= aa_00010.log ===> format_2 = aa_10.log Zeli_14_11_96_00012.log ===> format_1= Zeli_00012.log ===> format_2 = Zeli_12.log Bilal_23_18_00_00034.log ===> format_1= Bilal_00034.log ===> format_2 = Bilal_34.log ---------------------------------------------------------
sorry for mistake...
thxTest this - it should create two sets of files with the format you need=:
Code: [Select]echo off dir *.log /b /a-d |repl "(.*_).*_.*_.*_(.*\....)" "copy \q$&\q \q$1$2\q" xa >renfiles.bat dir *.log /b /a-d |repl "(.*_).*_.*_.*_[0]*(.*\....)" "copy \q$&\q \q$1$2\q" xa >>renfiles.bat call renfiles.bat del renfiles.bat pause
thank you very much
i am free now from tools
this files will work on auto
thats all working with repl.bat file.. i copy repl.bat file to windows directory
thank you very much for everythings sorry i will disturb you
this batch file creating NEW files for new (formated) file name
but... i dont need old file
just need NEW file names
how can do ?its true ?
------------------------------------------------------------------------------------------------------ dir *.log /b /a-d |repl "(.*_).*_.*_.*_(.*\....)" "ren $& $1$2" xa>renfiles.bat ------------------------------------------------------------------------------------------------------Try this: I change the copy to REN in the second repl command.
Code: [Select]echo off dir *.log /b /a-d |repl "(.*_).*_.*_.*_(.*\....)" "copy \q$&\q \q$1$2\q" xa >renfiles.bat dir *.log /b /a-d |repl "(.*_).*_.*_.*_[0]*(.*\....)" "ren \q$&\q \q$1$2\q" xa >>renfiles.bat call renfiles.bat del renfiles.bat pauseworking
thank you very much
|