1. Deleting Files

I know this is a lame question, but I am new to euphoria,
Using Win32lib or any other library, what command can be used to delete a
number of files in a folder using wildcards (eg. *.doc). I have used the
command for deleting 1 file (deleteFile) but cant get it to delete a whold
lot simultaneously.

Thanks
Mark

new topic     » topic index » view message » categorize

2. Re: Deleting Files

On 18 Jul 2001, at 11:01, mjwalter at deakin.edu.au wrote:


> 
> 
> I know this is a lame question, but I am new to euphoria,
> Using Win32lib or any other library, what command can be used to delete a
> number of files in a folder using wildcards (eg. *.doc). I have used the
> command for deleting 1 file (deleteFile) but cant get it to delete a whold
> lot simultaneously.

Get the directory listing into a sequence, check it for the files you want to 
delete, and delete them?

Or you could drop a .bat file into the directory, with dos commands to do it 
written to the .bat file, and exec the .bat file.

Kat

new topic     » goto parent     » topic index » view message » categorize

3. Re: Deleting Files

Well, the easiest and safest way you can use, is to use the euphoria
dir() function to get the file listing of that directory. Then look
trough the sequence looking for the files with that extention and using
deleteFile() with each one.

Untested code:

constant Where = "C:\My Documents"

sequence dirlist

dirlist = dir(Where)
for I = 1 to length(dirlist) do
   if find(".doc",dirlist[I][D_NAME]) then -- D_NAME is defined in
file.e
      deleteFile(Where & dirlist[I][D_NAME])
   end if
end for

Best Regards,
   Guillermo Bonvehi

> Date: Wed, 18 Jul 2001 11:01:50 +1000 (AUS Ea
> From: mjwalter at deakin.edu.au
> Subject: Deleting Files
> 
> 
> 
> I know this is a lame question, but I am new to euphoria,
> Using Win32lib or any other library, what command can be used to
> delete a
> number of files in a folder using wildcards (eg. *.doc). I have used
> the
> command for deleting 1 file (deleteFile) but cant get it to delete a
> whold
> lot simultaneously.
> 
> Thanks
> Mark

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu