|
Title: batch file help Post by: O_o on December 28, 2011, 09:48:05 AM I need to make a batch file that will automaticly renamed files to numbers.
??? Title: Re: batch file help Post by: Ignatius on December 28, 2011, 12:41:43 PM I'm not saying that I will necessarily be able to help, but can you give examples of how you need to have them renamed, i.e. maybe:
one.txt -----> 1.txt two.txt ------> 2.txt three.txt ----> 3.txt four.txt -----> 4.txt or jpvf.doc ------------> 1 wioeprt.rtf ----------> 2 wdopemxs.jpg -----> 3 qwerty.wmv --------> 4 etc. Title: Re: batch file help Post by: hayabusa on December 28, 2011, 01:44:36 PM You could write something like the following:
rename.bat set /a j=0 setlocal ENABLEDELAYEDEXPANSION for /f %%a IN ('dir /b *.*') do ( set /a j=j+1 rename %%a !j!%%~xa ) Edit: The %%~xa preserves the file extension. Note, if you don't MOVE the resulting file to somewhere else, such as don't use rename but instead copy %%a <some directory>/!j!%%~xa it'll try to catch the renamed files, too... So I'd use the copy and a temp dir, instead, perhaps creating the temp dir at the beginning of the batch file... Title: Re: batch file help Post by: O_o on April 19, 2012, 04:29:55 PM Thanx Mr.Hayabusa
Powered by SMF 1.1.18 |
SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com |