Hello,
Is it possible to use the rename command to rename a *.ITF file with
the filename of a TXT file in the same directory. For example
Directory 1 contains:
DEAL1.ITF
BRETT.TXT
DEAL1.LOG
Is it possible to rename DEAL1.LOG to BRETT.LOG (the same name of the
TXT file). The TXT file will be a different name each time, therefore
it needs to be some kind of variable rename i.e. always rename
the .LOG file to that of the .TXT filename.
Thanks,
Brett
Franc Zabkar - 31 Oct 2007 21:12 GMT
>Hello,
>
[quoted text clipped - 14 lines]
>
>Brett
Cut and paste the following commands into a .bat file, eg renamer.bat.
Then execute it.
=====================================
md dummydir
copy *.txt dummydir
cd dummydir
ren *.txt *.
for %%i in (*) do set txt_name=%%i
del %txt_name%
cd ..
copy *.log dummydir
cd dummydir
ren *.log *.
for %%i in (*) do set log_name=%%i
del %log_name%
cd ..
ren %log_name%.log %txt_name%.log
ren %log_name%.itf %txt_name%.itf
set log_name=
set txt_name=
rd dummydir
=====================================
- Franc Zabkar

Signature
Please remove one 'i' from my address when replying by email.