Sign in to follow this  
Followers 0
zxc3

Filedelete

12 posts in this topic

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...

Share this post


Link to post
Share on other sites



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


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

There was a topic a couple of days ago on this:

http://www.autoitscript.com/forum/index.php?showtopic=14813


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

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

<{POST_SNAPBACK}>

FileDelete will not delete a file that is in use.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

(" 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.

Share this post


Link to post
Share on other sites

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

<{POST_SNAPBACK}>

What external program ?


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0