Discussion:
Batch File program to search all physical drives and delete .jpg , .jpeg files
(too old to reply)
freeuserlogin
2009-11-11 19:28:41 UTC
Permalink
hi guys i am kitt

this is my first pos

i am new to batch file programming and need your hel

i need a batch file program when executed

it has to search all physical drives in my pc and delete file
of .jpg and .jpeg extension

i dont want to define the path of the file located at
so it has to search all the drives and delete file



Thank yo

--
freeuserlogi
-----------------------------------------------------------------------
freeuserlogin's Profile: http://forums.techarena.in/members/153950.ht
View this thread: http://forums.techarena.in/server-scripting/1269965.ht

http://forums.techarena.i
contrex
2009-11-11 20:39:49 UTC
Permalink
Why?
Pegasus [MVP]
2009-11-11 20:49:26 UTC
Permalink
hi guys i am kittu
this is my first post
i am new to batch file programming and need your help
i need a batch file program when executed
it has to search all physical drives in my pc and delete files
of .jpg and .jpeg extension
i dont want to define the path of the file located at
so it has to search all the drives and delete files
Thank you
freeuserlogin
You are actually in the wrong newsgroup. This group concentrates on VB
Script questions. Batch files are mostly answered in alt.msdos.batch.nt.
Since your question is quite simple, here is a batch file solution:

@echo off
for /F %%a in ('mountvol ^| find ":\"') do (
dir %%a 1>nul 2>nul
if not ErrorLevel 1 (
echo del /s /f %%a*.jpg
echo del /s /f %%a*.jpeg
)
)

To activate the batch file you need to replace these lines
echo del /s /f %%a*.jpg
echo del /s /f %%a*.jpeg
with these:
del /s /f %%a*.jpg
del /s /f %%a*.jpeg
Note that this is quite a powerful command. It will do exactly what you
asked for: Delete each and every .jpg and .jpeg file on all local drives.
Are you sure that you want to go ahead with your plan?
contrex
2009-11-11 22:34:31 UTC
Permalink
Post by Pegasus [MVP]
Are you sure that you want to go ahead with your plan?
Probably on somebody else's computer.
Al Dunbar
2009-11-12 04:50:19 UTC
Permalink
Post by Pegasus [MVP]
hi guys i am kittu
this is my first post
i am new to batch file programming and need your help
i need a batch file program when executed
it has to search all physical drives in my pc and delete files
of .jpg and .jpeg extension
i dont want to define the path of the file located at
so it has to search all the drives and delete files
Thank you
freeuserlogin
You are actually in the wrong newsgroup. This group concentrates on VB
Script questions. Batch files are mostly answered in alt.msdos.batch.nt.
I thought that this newsgroup was language neutral. There certainly are
non-vbs threads, and, unlike microsoft.public.scripting.vbscript, this one
doesn't have vbscript in its name. ;-)

/Al

<snip>

Loading...