1.

Solve : Batch file for deleting files based on absence files with same name?

Answer»

Hi there,

My first post here, im glad i found this forum and hopefully somebody is able to help me with the problem i have.

I have 5 directories which have different artwork (JPG, MP4) and 1 directory with dumped rom files of old computer games (70's & 80's).

What im trying is the following:

Based on the Rom map all unneeded files (same name, diffrent extension) needs to be deleted.

So if the rom map has a file called romA.zip all artwork in the other maps need to be untouched BUT if in the other 4 maps files are found which dont have a ROM file with the same name, they need to be deleted.

So the ROM directory is leading is all situations...

example:
RomA.zip has Map2\RomA.jpg, Map1\RomA.mp4 and are untouched.
RomB.zip is not present but Map2\RomB.jpg, Map1\RomB.mp4 are present! RomB.jpg, RomB.mp4 need to be deleted.

I tried so many things now but my batch programming knowledge isnt that good ;-)

Any examples are welcome .... Thank youQuote from: rikos on December 07, 2015, 05:34:44 AM

example:
RomA.zip has Map2\RomA.jpg, Map1\RomA.mp4 and are untouched.
RomB.zip is not present but Map2\RomB.jpg, Map1\RomB.mp4 are present! RomB.jpg, RomB.mp4 need to be deleted.

I can't see how romA.zip and romB.zip are related to each other. Or how 5 directories are involved.
Okay let me explain this.

example:

Map System contains
- Map R (contains Roms)
- Map A (contains artwork)
- Map B (contains artwork)
- Map C (contains artwork)
- Map D (contains artwork)

For every rom file there is artwork with EXACT the same name (diffrent ext) which are placed in the diffrent artwork maps (A, B, C &D).


First this, the directory structure is PART of a program called Hyperspin which is a Arcade Frontend for old games so it's not a choice for me. I have to DEAL with it ;-)

lets say: PACMAN

So normally there is 1 pacman file in all 5 directories with the same name, pacman.rom (MapR), pacman.png (MapA), pacman.png (MapB), pacman.png (MapC) and pacman.mp4 (MapD).

The MapR for roms is leading. When pacman.rom is deleted from MapG there are still 4 pacman files left on this disk. I want to scan these other maps for "Orphan" files. When the script is done MapA, MapB, MapC & MapD no longer have pacman files inside them.

You can do this by hand off course but we are talking here about almost 20.000 rom files ;-) (5 maps x 20000 rom, so 100000 files in total) So by hand deleting the files will take ages. My solution is to delete ALL rom files from MapG and copy back the rom files i need frommy backup instead of deleting them one by one.Thats why i need such a solution/script.Quote from: rikos on December 07, 2015, 07:28:43 AM
Okay let me explain this.

example:

Map System contains
- Map R (contains Roms)
- Map A (contains artwork)
- Map B (contains artwork)
- Map C (contains artwork)
- Map D (contains artwork)
You gave the examples above and then referred to Map G which didn't exist.
Quote
The MapR for roms is leading. When pacman.rom is deleted from MapG there are still 4 pacman files left on this disk. I want to scan these other maps for "Orphan" files. When the script is done MapA, MapB, MapC & MapD no longer have pacman files inside them.

It seems as though you want to delete one file, and then remove all other files with the same name.any_extension from every folder - except from Map R.

Are you manually deleting this file?


On re-reading your initial post - you are dealing with ZIP files.
It also seems that the "rom map" you are referring to is a text file with a list of names in it.

Hi,

sorry for the late responce.. Found a solution with a tool which COMPARES multiple locations and deletes the unneeded files.

Thnx for responding!


Discussion

No Comment Found