Operating System - Microsoft
1752620 Members
4144 Online
108788 Solutions
New Discussion юеВ

I'm looking for a batch file to rename files on NT 4.0 server

 
SOLVED
Go to solution
'chris'
Super Advisor

I'm looking for a batch file to rename files on NT 4.0 server

hi

I have NT 4.0 SP6a server and I'm looking for a batch file
to rename files from *.cc to *.bak at the same directory.

kind regards
chris
4 REPLIES 4
Vibhor Kumar Agarwal
Esteemed Contributor
Solution

Re: I'm looking for a batch file to rename files on NT 4.0 server

There are 2 options which I use generally.

First: Download cygwin, now you will be able to run unix commands, then its simple

for filename in "*.cc"; do
new_name=`sed -e "s/\.cc/\.bak/g"'
mv filename new_name
done

Second: If you really want to stick with .bat files, then downlaod Gnu sed. It works in Windows.
Then combine the above sed statement with windows for loop.

Vibhor Kumar Agarwal
Antoniov.
Honored Contributor

Re: I'm looking for a batch file to rename files on NT 4.0 server

Hi Chris,
I appear as dummy but I don't understand your question.
I guess the command
REN *.CC *.BAK
is too simple for your scope.
Also
FOR %I IN (*.CC) DO REN %%I *.BAK
may be too simple

Please,
may you specify some furthermore information?

Antonio Vigliotti
Antonio Maria Vigliotti
'chris'
Super Advisor

Re: I'm looking for a batch file to rename files on NT 4.0 server

yes I've forgotten

it should rename files and put already renamed files
to the other server via share \\server\directory

greetings
chris
Antoniov.
Honored Contributor

Re: I'm looking for a batch file to rename files on NT 4.0 server

Chris,
do you need diagnostic information?
Youc move file with a command file like this:
Rem Example
Rem Rename all file in current directory
REN *.CC *.BAK
Rem Now copy file onto remote server
COPY *.BAK \\SERVER\DIRECTORY
Rem Now delete from current directory
DEL *.BAK

Above command file is merely an example. It does't check error status and doesn't check id copy successfully terminated.

Antonio Vigliotti
Antonio Maria Vigliotti