1.

Solve : How to copy files with the same name??

Answer»

Hi GUYS,

I'm using batch files and I've got myself TIGHT on something here, i have a folder A which has three files:

Code: [Select]contract.txt
contract.ctl
contracting.txt
contracted.ctl
I want to copy to a folder B only files with the same name, which would be:

Code: [Select]contract.txt
contract.ctl
How can i do that? Is there any codition i can put on my batch file?

Regards,Suppose that there isn't any space in the name of the files.
Code: [Select]echo off & setlocal enabledelayedexpansion
for /f %%a in ('dir/b/a-d A') do SET /a %%~na+=1
for /f %%a in ('dir/b/a-d A') do if !%%~na! gtr 1 copy A\%%a BHi Prince_

Thankx MAN i got it running and it's working PERFECTLY but seriously i don't understand how this works! in details

Can you break it down for me?

Regards,



Discussion

No Comment Found