Sign in to follow this  
Followers 0
Hina

How to delete

16 posts in this topic

How can delete a folder on any location for example I create a folder @ desktop how can I delete it by autoit

Share this post


Link to post
Share on other sites



COMSATS,

Look at DirRemove in that ever useful Help file.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

But if the folder is in for example D drive & I want that when D-Drive is open then that folder delete automatically how can I do that??

Share this post


Link to post
Share on other sites

COMSATS,

A little more information on what you are trying to do, please. Are you opening the drive from within your script? Why do you need to delete the folder as soon as the drive is accessed?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

No I don't want to open the drive through my script. I want that 1st I create any empty folder in D drive then when I open the D-drive & folder with "h" name is present their it get deleted. can u give me the idea only?

Share this post


Link to post
Share on other sites

OK. So your script is creating the folder or the user is creating the folder?

After the folder is created you want your script to be able to "recognize" the shell viewer is about the show the content of the D drive and before the user can see the content you want to delete the folder named "h"?

Share this post


Link to post
Share on other sites

Yes Yes U got it brother Authenticity now tell me how can I do that I am confuse I already tried WinExisit method but fail. Tell me how to do that. Thx for ur reply

Share this post


Link to post
Share on other sites

Try to set the folder attribute using the FileSetAttribute function to system attribute. It's unlikely that you'll find system which "Hide protected operating system files (Recommended)" is not checked in the folder options.

Share this post


Link to post
Share on other sites

But FileSetAttrib will not delete the folder infect it will remain @ the very same place but just hidden only brother

Share this post


Link to post
Share on other sites

if its +SH then you can't open the folder....

Share this post


Link to post
Share on other sites

Yes I know that by using "+SH" it will be supper hidden & won't open but it will remain @ the very same place

Share this post


Link to post
Share on other sites

then.... do what melba23 said DirRemove()

are you wanting IF winexists() the dirremove()

or.. if a process is viewing files then dirremove()

... then you want to do somethinig else

Share this post


Link to post
Share on other sites

I already tried that thing that

$a="Local Disk (D:)"
If WinExsist($a)Then
    Dirremove($a&"\H")
EndIf

But this code dosen't work for me

Share this post


Link to post
Share on other sites

COMSATS,

The solution is trivial - it takes me 8 lines of code. But I still want to know why you want to do this - something makes me think that deleting a folder the moment a drive is opened in Explorer is not something I want to help with. Unless you can prove me wrong, of course! :-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

There is no wrong purpose behind this thing actually I am doing it to know that how can we remove, Move, Edit etc without giving the code full path rather than to associate it with the existance of a window. I do hope that U go the point plz share the code with me brother

Share this post


Link to post
Share on other sites

COMSATS,

OK, I will trust you on this. ;-)

This script deletes the folder "h" on the "D:" drive as soon as Explorer opens a window with the contents of the D: root folder:

#include <Array.au3>
While 1
    $aArray = WinList()
    If _ArraySearch($aArray, "(D:)", 0, 0, 0, 1) <> -1 Then
        DirRemove("D:\h", 1)
        ExitLoop
    EndIf
WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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