Re: How to Delete Files in Folder Which Don't Match Files in Another Folder

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
news:up6aJbyBIHA.4176@xxxxxxxxxxxxxxxxxxxxxxx

"Davy" <david@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:aNydnfM2-MOWcJjanZ2dneKdnZydnZ2d@xxxxxxxxxxxxxxxxx
My digital camera produces both a 'raw' and a jpg version of each image.
The
file names are identical except for the .raw and .jpg extensions.

I put all the .raw images in a 'RAW' folder and all the jpg images in a
JPG
folder. I browse the jpg folder quickly using Irfanview, deleting poor
images. Then I need to delete equivalent files in the RAW folder. This
action is error prone if I do it manually so I need a script.

I have a little experience of VBS scripting and would appreciate a
suggestion that might get me started.
I use VBS 6 in Windows 2000.

many thanks in advance,

Davy


You can do this with a single line batch file like so:

@echo off
for %%a in (d:\raw\*.raw) do if not exist d:\jpg\%%~na.jpg echo del %%a

Remove the word "echo" to activate the batch file.

Pegasus,
thanks for that; works beautifully. Although does not work if the file name
has a space in it but this should not be a problem since the camera
generates file names without spaces,
thanks, Davy


.



Relevant Pages