compare a text file with files...

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

compare a text file with files...

#1 Post by trekdrop » 20 Jul 2014 10:35

Hi,

I really hope you can help me. I have a list with ROMs that I can run in coinops (old Xbox emulator) its a text file. And I have a file with more than 10000 ROMs in it. Iam looking for a batch command that can copy the ROMs that listed in the text file. Here is some info.

Place where the ROMs are:

F:\emulators\mame\roms\

Place where the text file is:

F:\coinops\

Name of the text:

Coinopslist.text

Place where the roms need to go:

F:\coinops\roms\

It would be so awesome if someone can help me!

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: compare a text file with files...

#2 Post by foxidrive » 20 Jul 2014 11:10

This assumes the files are listed one per line in the text file and that the files all exist in F:\emulators\mame\roms\

Code: Select all

@echo off
md "F:\coinops\roms\" 2>nul
for /f "usebackq delims=" %%a in ("F:\coinops\Coinopslist.text") do copy "F:\emulators\mame\roms\%%a" "F:\coinops\roms\"
echo done
pause

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#3 Post by trekdrop » 20 Jul 2014 14:29

Yes thanks!!

where do i place the bat file?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: compare a text file with files...

#4 Post by foxidrive » 20 Jul 2014 19:44

It doesn't have to be in a specific location.

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#5 Post by trekdrop » 21 Jul 2014 00:44

i am getting a error:

The system cant find the file

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#6 Post by trekdrop » 21 Jul 2014 03:17

i probely did something wrong...

Now it scans the .txt file but isnt coping anything to the folder.
it says it cant find any files...

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: compare a text file with files...

#7 Post by foxidrive » 21 Jul 2014 03:22

In front of the copy put an echo so it says do echo copy "F:\emulators\mame\roms\%%a" "F:\coinops\roms\"

Then launch the batch file and see what the loop prints to the console.
You can copy and paste in a reply if you need to.

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#8 Post by trekdrop » 21 Jul 2014 11:58

copy "F:\emulators\mame\roms\zerotime" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zerotrgt" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zerowing" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zerozone" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zigzag" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zigzag2" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zingzip" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zintrckb" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zipzap" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\znpwfv" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zoar" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zodiack" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zombraid" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zookeep" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zookeep2" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zookeep3" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zoom909" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zunkyou" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zupapa" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zupapan" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zwackery" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zzyzzyx2" "F:\coinops\roms\"
copy "F:\emulators\mame\roms\zzyzzyxx" "F:\coinops\roms\"


these are the last lines. it doesnt copy any files to F:\coinops\roms\

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: compare a text file with files...

#9 Post by Squashman » 21 Jul 2014 13:00

Are you missing the file extension in your CoinOpsList.txt file?

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#10 Post by trekdrop » 21 Jul 2014 13:10

file extension??

whats that?
Last edited by trekdrop on 21 Jul 2014 13:14, edited 1 time in total.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: compare a text file with files...

#11 Post by Squashman » 21 Jul 2014 13:11

trekdrop wrote:file extention??

whats that?

Extension.
.txt, .pdf, .doc, .xls, .rom, .mame, etc, etc, etc.

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#12 Post by trekdrop » 21 Jul 2014 13:17

oh Man!

Your right!

Now i need to find a way to add .zip to every rom in the text file...


this is just s sample from the txt

005
1941
1941j
1942
1942a
1942b
1943
1943j
1943kai
1944
1944j
1945kiii
19xx
19xxa
19xxh
19xxj
19xxjr1
2020bb
2020bba
2020bbh
280zzzap
3countb
3in1semi
3kokushi
3stooges
3wonders
3wonderu
40love
47pie2
47pie2o
4dwarrio
4enraya
4in1
4in1boot
600
64streej
64street
720
720g
720gr1
720r1
720r2
720r3
7jigen
7toitsu
800fath
88games
8ball
8ball1
8ballact
8ballat2
8bpm
99lstwar
99lstwra
9ballsh2
9ballsh3
9ballsht


and they need to be:

005.zip
1941.zip
1941j
1942
1942a
1942b
1943
1943j
1943kai
1944
1944j
1945kiii
19xx
19xxa
19xxh
19xxj
19xxjr1
2020bb
2020bba
2020bbh
280zzzap
3countb
3in1semi
3kokushi
3stooges
3wonders
3wonderu
40love
47pie2
47pie2o
4dwarrio
4enraya
4in1
4in1boot
600
64streej
64street
720
720g
720gr1
720r1
720r2
720r3
7jigen
7toitsu
800fath
88games
8ball
8ball1
8ballact
8ballat2
8bpm
99lstwar
99lstwra
9ballsh2
9ballsh3
9ballsht

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: compare a text file with files...

#13 Post by Squashman » 21 Jul 2014 13:24

If all the ROMS you want to move have a .ZIP file extension but you don't have it in your text file then just add it to the code.

Code: Select all

copy "F:\emulators\mame\roms\%%a.ZIP" "F:\coinops\roms\"

trekdrop
Posts: 10
Joined: 20 Jul 2014 10:25

Re: compare a text file with files...

#14 Post by trekdrop » 21 Jul 2014 13:31

even if i add .rar or .zip to the fisrt roms in the txt it still doesnt copy anything...

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: compare a text file with files...

#15 Post by Squashman » 21 Jul 2014 13:33

trekdrop wrote:even if i add .rar or .zip to the fisrt roms in the txt it still doesnt copy anything...

Did you remove the ECHO in front of the COPY command?

Post Reply