Re: Kill all text files except those starting with ~$
- From: Bob Quintal <rquintal@xxxxxxxxxxxx>
- Date: Fri, 25 Nov 2005 22:35:34 GMT
"Dixie" <dixie@xxxxxxxxxxx> wrote in
news:43878821$1@xxxxxxxxxxxxxxxxxxxxxx:
> I am trying to write some code that when I exit my application
> kills all of the text files in a certain folder. It is
> possible that some of those files are locked because someone
> else is using them, in which case they will have the first two
> letters of their name replaced with ~$. How can I write a
> routine that will delete all the normal *.txt files, but not
> attempt to delete the ~$ ones, which brings up an error
> message and prevents the program from closing. I thought this
> would be easy, but I have not managed to do it after quite a
> while trying.
>
> dixie
>
Scan the directory in question using the dir() function.
Then code an if block that deletes the offending files.
Untested code:
x = dir$("C:\directory to clean")
do while len(x) >0
if left(x,2) <> "~$" then
kill x
endif
x = dir$
loop
--
Bob Quintal
PA is y I've altered my email address.
.
- Follow-Ups:
- References:
- Prev by Date: Compile error causes MDE creation to fail in A97???
- Next by Date: Re: ADP bound form - force record save, recordsetclone not populating after requery
- Previous by thread: Kill all text files except those starting with ~$
- Next by thread: Re: Kill all text files except those starting with ~$
- Index(es):
Relevant Pages
|