Page 1 of 1

Rename question

Posted: 09 Dec 2016 12:09
by born2achieve
I have bat file and i need to rename files in the folder of one server from another server.

Below the sample i tried and didn't work.

Code: Select all

Ren "\\178.70.140.230\Development\Company\*.txt" "*.bak"

but it's not changing the extension Any suggestion please how to achieve this.

Re: Rename question

Posted: 09 Dec 2016 12:17
by Squashman
Use the FOR command to iterate through the list of files and then do the rename.

Just like we showed you in this question.
viewtopic.php?f=3&t=6486#p41489

Re: Rename question

Posted: 09 Dec 2016 13:01
by ShadowThief
Weird; ren *.txt *.bak should totally work.

Try

Code: Select all

pushd "\\178.70.140.230\Development\Company\"
ren *.txt *.bak
popd

Re: Rename question

Posted: 09 Dec 2016 13:22
by Squashman
born2achieve wrote:I have bat file and i need to rename files in the folder of one server from another server.

Below the sample i tried and didn't work.

Code: Select all

Ren "\\178.70.140.230\Development\Company\*.txt" "*.bak"

but it's not changing the extension Any suggestion please how to achieve this.


I tested this and it worked.

Code: Select all

ren "\\Server\Share\Squashman\rename\*.txt" *.bak