Jump to content

Recommended Posts

Posted

How to remove files from a folder, not knowing names of files contained in a folder if one of files is used by the unknown external program?

Filedelete ("D:\folder1") command does not work...

Posted

Filedelete ("D:\folder1\*.*") you needed the wild card

<{POST_SNAPBACK}>

FileDelete will not delete a file that is in use.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Posted

FileDelete will not delete a file that is in use.

<{POST_SNAPBACK}>

Commands Filedelete (" D:\foldrer1\*. * ") and Filedelete ("D:\foldrer1") work equally.

But both of them do not work in my case - I have tried. Files do not delete in general.

Thanks.

Posted

Below is a link to a utility that can tell what is locking a file that is in use.

http://www.dr-hoiby.com/WhoLockMe/index.php


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Posted

Below is a link to a utility that can tell what is locking a file that is in use.

http://www.dr-hoiby.com/WhoLockMe/index.php

<{POST_SNAPBACK}>

Why this program works

$i=0

FileChangeDir("d:\folder1")

$search = FileFindFirstFile("*.*") ; Check if the search was successful

If $search = -1 Then

;MsgBox(0, "Error", "end")

$I=1

else

$i=0

EndIf

While $i<>1

$file = FileFindNextFile($search)

if $file="" then exit

$DEL=("D:\folder\") & ($file)

;MsgBox(0, "$del", $del,1)

filedelete($del)

If @error Then ExitLoop

WEnd

And it is simple filedelete (" D:\folder\*. *) does not work?

Posted

And it is simple filedelete (" D:\folder\*. *) does not work?

(" D:\folder\*. *) should be (" D:\folder1\*. *")

Assuming none of the files are in use it should work


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Posted

(" D:\folder\*. *)  should be (" D:\folder1\*. *")

Assuming none of the files are in use it should work

<{POST_SNAPBACK}>

Yes, thanks for specification, this command does not work, if though one file is borrowed with the external program.
Posted

Yes, thanks for specification, this command does not work, if though one file is borrowed with the external program.

<{POST_SNAPBACK}>

What external program ?


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Posted

What external program ?

<{POST_SNAPBACK}>

My problem - to remove a folder to which have access many users of a local area network.

I.e. to disconnect from files of users, and then to erase a folder, but I am not confident, that during disconnect, someone will not try to be connected again, etc.

Posted

My problem - to remove a folder to which have access many users of a local area network.

I.e. to disconnect from files of users, and then to erase a folder, but I am not confident, that during disconnect, someone will not try to be connected again, etc.

<{POST_SNAPBACK}>

You could always use FileSetAttrib to make the folder read only and then set it back afterwards.

:whistle::dance::dance:


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...