Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Delete unknown files


Message #1 by "Kumar, Pankaj" <KUMARPA@t...> on Thu, 23 May 2002 14:57:32 +0530
I haven't tested the following.

I have gone simular thing in the past
and I hope that the following format
either "works" or at least gets you
to a starting point from which you
might proceed.

Dave

=============================

sub KillThem

Dim TheDrive as string
Dim TheFolder as String
Dim TheFile as String
Dim TheExt as string
Dim TheCnt as integer

'assign to meet your needs
thedrive = "C:\"
thefolder= "My Documents\"


for TheCnt = 1 to 2
select case TheCnt
case = 1
      TheExt = "*.img"
case = 2
      TheExt = "*.dat"
end select



thefile = dir(TheDrive & TheFolder & TheExt)

if thefile <> ""
do while thefile <> ""
thefile = thedrive & thefolder & thefile
kill thefile
dir()
loop

next TheCnt

end sub




> 
> From: "Kumar, Pankaj" <KUMARPA@t...>
> Date: 2002/05/23 Thu AM 05:27:32 EDT
> To: "professional vb" <pro_vb@p...>
> Subject: [pro_vb] Delete  unknown files
> 
> Hi,
>  I have files (with known extension) but don't know name of the files.
>  I want to delete files only with specific extensions
>  
>  For example if folder has xx.dat, xx.img, xx.txt DELETE ONLY xx.dat, xx.img
> 
>  
>  Thanks in advance.
> 
>  Pankaj
>  kumarpa@t...
>  
> 
> 


  Return to Index