1.

Solve : Delete all fies except jpg ones?

Answer»

Hello, i need to DELETE all files that aren't .jpg inside a DIR,


Can someone help me, thanks in advanceThis is at the command prompt, in a batch change %F to %%F in both places.

Quote

for /f "delims=" %F in (' dir /b ^| find /v /i ".jpg" ' ) do del "%F"


Salmon Trout,
Very good.
Now do it without the FOR loop

Set all files to ARCHIVE.
Set all JPG to not archive.
Delete archive files.
Code: [Select]D:\BAT>attrib *.* +A
D:\BAT>attrib *.JPG -A
D:\BAT>del *.* /a:A
D:\BAT\*.*, Are you sure (Y/N)? y
Quote from: Geek-9pm on July 08, 2010, 11:44:15 AM
Now do it without the FOR loop

Why? 3 lines versus 1, and you have to hit a key (although you could echo Y through a pipe to del) and you have to interfere with all the other files' archive bits.

Quote from: Salmon Trout on July 08, 2010, 12:00:20 PM
Why? 3 lines versus 1, and you have to hit a key (although you could echo Y through a pipe to del) and you have to interfere with all the other files' archive bits.
Thanks. Good answer.Thanks


Discussion

No Comment Found