Copy file based on match name file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
darioit
Posts: 230
Joined: 02 Aug 2010 05:25

Copy file based on match name file

#1 Post by darioit » 11 Nov 2010 01:29

Hello Everybody,

I have a lot file named:
aa1.bb5.ccc.001
aa2.bb6.ccc.010
aa3.bb7.ddd.123
aa4.bb8.ddd.456

Executing a batch passing a parameter equal 3 qualifier (ccc or ddd) I-d like to copy all the files that are equal in 3 qualifier, like this example

run_batch.bat ccc
result ccc (name file) given from file aa1.bb5.ccc.001+aa2.bb6.ccc.010

Regards
Dario

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Copy file based on match name file

#2 Post by !k » 11 Nov 2010 09:27

Code: Select all

for /f %%a in ('dir *.%1.* /b/a-d/on') do type "%%a" >> %1

darioit
Posts: 230
Joined: 02 Aug 2010 05:25

Re: Copy file based on match name file

#3 Post by darioit » 11 Nov 2010 10:49

Works Great, may Thanks

Dario

Post Reply