|
Home > Archive > Programming with dBASE > July 2005 > Files deletion
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Michael Nunn 2005-06-27, 1:23 pm |
| I need to be able to delete the entire contents of a directory without
confusing the user.
As far as I can see, the XBase erase command is designed to delete one file
at a time - so I would need to do some complicated maneouvres involving DOS
and a text file to get the directory into an array and step through it.
Using the run/! erase *.* route works, but of course the user is faced with
a DOS window asking 'are you sure?' Since I don't want the user to be
worried about the detail of what is going on, I'd rather that didn't happen.
I'd be grateful for suggestions.
Mike
| |
| Bruce Beacham 2005-06-27, 1:23 pm |
| Michael Nunn wrote:
> I need to be able to delete the entire contents of a directory without
> confusing the user.
>
> As far as I can see, the XBase erase command is designed to delete one file
> at a time - so I would need to do some complicated maneouvres involving DOS
> and a text file to get the directory into an array and step through it.
Not so. You can use
a = new array()
a.dir("C:\dirtodelete\*.*")
and run through that.
Or use run deltree.
Bruce Beacham
| |
| Michael Nunn 2005-06-27, 1:23 pm |
| Wonderful - thanks.
Mike
"Bruce Beacham" <bbeacham@beacham.no-spam.co.uk> wrote in message
news:XjJ0OyzeFHA.1188@news-server...
> Michael Nunn wrote:
>
> Not so. You can use
>
> a = new array()
> a.dir("C:\dirtodelete\*.*")
>
> and run through that.
>
> Or use run deltree.
>
>
> Bruce Beacham
| |
| Denis Finch 2005-06-27, 8:23 pm |
| Here is sample code that I use. It is like Bruce, but I also remove the
directory in this example:
oarray = new array()
c = set("Directory") + "\Data\Audit Folders\" +
trim(form.listbox1.value)
oarray.dir(c + "\*.*")
f = new file()
for i = 1 to alen(oarray,1)
f.delete(c + "\" + oarray[i,1])
endfor
RemoveDirectory(c)
"Michael Nunn" <mbnunnuk@yahoo.co.uk> wrote in message
news:G3B5QwzeFHA.1188@news-server...
> I need to be able to delete the entire contents of a directory without
> confusing the user.
>
> As far as I can see, the XBase erase command is designed to delete one
file
> at a time - so I would need to do some complicated maneouvres involving
DOS
> and a text file to get the directory into an array and step through it.
>
> Using the run/! erase *.* route works, but of course the user is faced
with
> a DOS window asking 'are you sure?' Since I don't want the user to be
> worried about the detail of what is going on, I'd rather that didn't
happen.
>
> I'd be grateful for suggestions.
>
> Mike
>
>
>
| |
| Ivar B. Jessen 2005-06-28, 3:23 am |
| On Mon, 27 Jun 2005 18:13:36 +0100, "Michael Nunn"
<mbnunnuk@yahoo.co.uk> wrote:
>I need to be able to delete the entire contents of a directory without
>confusing the user.
Lookup the following message:
Message-ID: < 9pkva1h3q63ismovp50t
d215i04v9pchkr@4ax.com>
Ivar B. Jessen
| |
| Michael Nunn 2005-06-28, 1:23 pm |
|
Ivar B. Jessen wrote
> Lookup the following message:
> Message-ID: < 9pkva1h3q63ismovp50t
d215i04v9pchkr@4ax.com>
You've foxed me here - I am using Outlook - how do I search for message
with a Message-ID?
I have options for searching on From/To/Subject/Message.
Mike
| |
| Ivar B. Jessen 2005-06-28, 1:23 pm |
| On Tue, 28 Jun 2005 17:55:18 +0100, "Michael Nunn"
<mbnunnuk@yahoo.co.uk> wrote:
>
>
>You've foxed me here - I am using Outlook - how do I search for message
>with a Message-ID?
>
>I have options for searching on From/To/Subject/Message.
Outlook, don't you mean Outlook Express?
In Forte Agent you click on the Message-ID and a dialog box pops up
asking if the URL is an Email-address or a Message-ID, then click on
the Message-ID button and you are taken directly to the message.
It may be similar in Outlook Express.
The message I pointed to gave a function to _delete_ a folder, by
rereading you question I noticed that you only want to _empty_ the
folder.
Save the code below as emptyFolder.prg, then create a folder
C:\testTemp, fill it with a couple of files and finally in the command
pane type emptyFolder("C.\testTmp").
Ivar B. Jessen
//-----
function emptyFolder(cFolderP
ath)
// Use from command pane:
// emptyFolder("C:\testTmp")
// The second parameter in fso.DeletFile( ...) is of type
// boolean and is optional. Set it to true if files with
// the read-only attribute set are to be deleted;
// false (default) if they are not.
fso = new oleautoclient("Scripting.FileSystemObject")
if fso. FolderExists(cFolder
Path)
try
fso. DeleteFile(cFolderPa
th + "\*.*", true )
catch(exception e)
msgbox(e.message)
endtry
return
else
msgbox("Folder not found")
endif
return
//-----
| |
| Bruce Beacham 2005-06-28, 1:23 pm |
| Ivar B. Jessen wrote:
> In Forte Agent you click on the Message-ID and a dialog box pops up
> asking if the URL is an Email-address or a Message-ID, then click on
> the Message-ID button and you are taken directly to the message.
Not in Thunderbird. :-(
Bruce Beacham
| |
| Michael Nunn 2005-06-28, 8:23 pm |
| Ivar B. Jessen wrote:
> Outlook, don't you mean Outlook Express?
Yes, pardon me.
> In Forte Agent you click on the Message-ID and a dialog box pops up
> asking if the URL is an Email-address or a Message-ID, then click on
> the Message-ID button and you are taken directly to the message.
Initially I clicked on the ID in your message and it opened up a new message
form and put the ID in the
email address field.
> Save the code below as emptyFolder.prg, then create a folder
> C:\testTemp, fill it with a couple of files and finally in the command
> pane type emptyFolder("C.\testTmp").
Thank you - again, I am 'spoilt for choice' with the suggestions offered -
but I am interested in the folder removal function. Denis Finch provided an
example (again, for which, thanks) with a reference to a RemoveDirectory
function, which doesn't seem to be a built in function with v 2.21.
As a second step to what I am doing I do remove the folder and am currently
reduced to <run rd>.
Again thanks - unfortunately, as you will gather, I haven't been able to
access the delete_a _folder function via the ID provided.
Mike
| |
| Ivar B. Jessen 2005-06-29, 3:23 am |
| On Tue, 28 Jun 2005 21:55:16 +0100, "Michael Nunn"
<mbnunnuk@yahoo.co.uk> wrote:
>
>Thank you - again, I am 'spoilt for choice' with the suggestions offered -
>but I am interested in the folder removal function. Denis Finch provided an
>example (again, for which, thanks) with a reference to a RemoveDirectory
>function, which doesn't seem to be a built in function with v 2.21.
>
>As a second step to what I am doing I do remove the folder and am currently
>reduced to <run rd>.
So you _are_ looking for a way to delete a folder :-)
Search the programming group for a thread with the subject "Delete a
folder with all its subfolders". The first message in the thread is
dated 14-06-2005.
I hope that Outlook Express is able to seach a newsgroup ;-)
Ivar B. Jessen
| |
| Michael Nunn 2005-06-29, 1:23 pm |
| Ivar Jessen wrote:
>
> Search the programming group for a thread with the subject "Delete a
> folder with all its subfolders". The first message in the thread is
> dated 14-06-2005.
>
> I hope that Outlook Express is able to seach a newsgroup ;-)
Yes, Outlook Express found it - although to get the thread grouped it was
easier to list the subjects in alphabetical order and page down.
And I implemented the oleautoclient("Scripting.FileSystemObject") method
successfully, so thanks for that.
But my virus checker (McAfee) did not like what was going on one bit
(Suspicious scripting activity in Plus.exe). That would frighten a user -
have you come across this one?
Mike
| |
| Ivar B. Jessen 2005-07-01, 3:23 am |
| On Wed, 29 Jun 2005 18:41:57 +0100, "Michael Nunn"
<mbnunnuk@yahoo.co.uk> wrote:
>And I implemented the oleautoclient("Scripting.FileSystemObject") method
>successfully, so thanks for that.
You are welcome.
>But my virus checker (McAfee) did not like what was going on one bit
>(Suspicious scripting activity in Plus.exe). That would frighten a user -
>have you come across this one?
This problem has been discussed before. See copy of message below my
signature.
Ivar B. Jessen
**********
On Tue, 7 Jun 2005 10:08:28 +0200, *Lysander* <nobody@nowhere.com>
wrote:
>In article < 8uu8a1t6pt7kb9ap16p3
ek4710mt1qjsk2@4ax.com>,
>bergishagen@it.notthis.dk says...
>
>
>There are different approaches for different systems. That is the reason
>why on every "remote" or "foreign" system you might find another
>situation, because every admin can choose different weapons or no weapon
>at all :)
>
>Under W95, W98, WME you can make a clean uninstall, because it is an
>option when installing Windows. Under W2K and XP you will have to
>disable the features somehow.
>
>I tried to find _MY_ guide on it as HTML, but was not successful in it.
>It was in an article of the German c't-magazine, some 2-4 years ago.
>
>Here is what you could find helpful instead:
>http://www.zdnetindia.com/help/alerts/stories/1243.html
>... but this, according to my opinion, only disables automatic execution
>of *.vbs attachments in e-mails.
>
>or, as a general page about WSH, including some warnings (but also some
>nice features of WSH...)
>http://fox.wikis.com/wc.dll? Wiki~W...tin
gHost
>
>Here is what I did in our company to turn off the WSH:
>- delete, relocate, or rename the following files:
> - wsript.exe
> - wshext.dll
> - wshom.ocx
>In W2K you will find those files usually in "c:\winnt\system32\"
>
>Hope this helps.
*********
|
|
|
|
|