Forum | | | | - Page 1 - |
| Julian Schmidt | How can a directory on the elegantesten with all Unterverzeichnissen and everything encompassed Files delete? |
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/24/11 ▲ |
| |
| | | | - Page 2 - |
| | « this Posting watts as Solution marked. » | | - Page 3 - |
| Dieter Zornow | Why take You not simply The API to delete. here's one flexibler code for Delete, copy rename and moving. according to Parameter can you into wastebasket or not delete, integrally How You want. the erspart still whom whole Hickhack and operates reliably. in the example becomes without demand a directory with Unterverzeichnissen not into wastebasket deleted
' Parameter 1: Auszuführende Operation=COPY, DELETE, RENAME, MOVE
' Parameter 2: Quelldatei(en)
' Parameter 3: Zielldatei(en)
' Parameter 4: 0 = user ask, 1= without demand delete
' Parameter 5: 0 = In wastebasket move, 1= "endgültig" delete
' Parameter 6: 0 = Cancel with vorhandener File, 1 = copy the File lay out
Proc SHFileoperation
Parameters operation$,File$,File2$,confirm%,recycle%,can%
Declare opstruct#,file#,file2#,title#,operation&
Var FOF_Flag% = 1 | 512 | 2048'FOF_MULTIDESTFILES,FOF_NOCONFIRMMKDIR,FOF_NOCOPYSECURITYATTRIBS
Dim title#,24
string title#,0 = "Fileoperation Progress"
Select upper$(operation$)
CaseOf "RENAME"
operation&=4
CaseOf "COPY"
operation&=2
CaseOf "MOVE"
operation&=1
CaseOf "DELETE"
operation&=3
endselect
case confirm%:confirm%=16
Casenot recycle%:recycle%=64
If can%
FOF_Flag% = FOF_Flag% | confirm% | recycle% | $20 | 8'$20 = FOF_WANTMAPPINGHANDLE 8 = FOF_RENAMEONCOLLISION
Else
FOF_Flag% = FOF_FLAG% | confirm% | recycle%'16 = FOF_NOCONFIRMATION,64 = FOF_ALLOWUNDO
endif
Dim opstruct#,30:Dim file#,(Len(file$)+2):Dim file2#,(Len(file2$)+2)
String file#,0=(file$+Chr$(0)):String file2#,0=(file2$+Chr$(0))
Long opstruct#,0=GetActiveWindow()' lever the aufrufenden Fensters
Long opstruct#,4=operation&'which Dateioperation made becomes
Long opstruct#,8=file#' pfrom : here The Files for operation
Long opstruct#,12=file2#'pto here The Zieldateinamen or 0
Word opstruct#,16=FOF_Flag%
Long opstruct#,18=0'with discontinue standing here 1 only long Operationen
Long opstruct#,22=0' must always zero his, here becomes lever for SHNameMappings staid with copy
Long opstruct#,26=Title#'Headline the Fortschrittsdialogs with long Operationen
Var FEHLER&=External("SHELL32","SHFileOperationA",opstruct#)
IF (long(opstruct#,18)=1)
MessageBox("Die Dateioperation aborted!","Abbruch through user!",64)
ELSEIF (Fehler& <> 0)
MessageBox(st$(fehler&),"Es is a Error aufgetreten",16)
EndIf
If val($WinVer)> 5.0
Case LONG(opstruct#,22) <> 0:External("Shell32","SHFreeNameMappings",LONG(opstruct#,22))'mins XP
endif
Dispose file#,file2#,opstruct#,title#
ENDPROC
cls
SHFileoperation("Delete","c:\\Temp\\Test\\","",1,1,0)
print "fertig"
Waitinput
end
|
| | | Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 07/26/11 ▲ |
| | |
| | | Schonmal to ChooseDir$ one print getDir$("@") made?
Perhaps. should You additional too to the Delete eachone individual File whom Dateipfad the File (z.B. with mid$ ) with the chosen directory vergleichen. |
| | | | |
| | Julian Schmidt | @Thomas - No, into wastebasket should The Files to the delete not disembark. Erase is already aale even if not restlos is. @Marc - No, what's this thing deltree? example? @IF: - iF (25.07.11)
Schonmal to ChooseDir$ one print getDir$("@") made?
How should the functions? can du's into code install?
iF (25.07.11)
Perhaps. should You additional too to the Delete eachone individual File whom Dateipfad the File (z.B. with mid$ ) with the chosen directory vergleichen.
good idea!
delete_folder_completely("C:\\Test")
'delete_folder_completely(ChooseDir$("Verzeichnis dial:"))
Messagebox("Ordner gelöscht","INFO",64)
Proc delete_folder_completely
Parameters way$
var addfiles.dll&=ImportDLL("addfiles.dll","")
var h&=Create("List", 0)
Chdir way$
case @$ GetDir("@")=way$ : AddFiles("*.*",h&,1)
MoveListToHandle(h&)
whileloop GetCount(h&)
case Left$(GetString$(h&,&loop-1),Len(way$))=way$ : Erase GetString$(h&,&loop-1)
Endwhile
clearlist h&
Chdir way$
case @$ GetDir("@")=way$ : AddDirs("*.*",h&,1)
whileloop GetCount(h&),1,-1
case Left$(GetString$(h&,&loop-1),Len(way$))=way$ : RmDir GetString$(h&,&loop-1)
Endwhile
destroywindow(h&)
case @$ GetDir("@")=way$ : RmDir way$
FreeDLL addfiles.dll&
ENDPROC
@All furthermore stay several ask open.
Why becomes the Ausgangsordner not deleted? withal the row "case @GetDir$("@")=Pfad$ : RmDir way$". Why comes if I The first Line in "delete_folder_completely(ChooseDir$("Verzeichnis dial:"))" change a Error Message? |
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/25/11 ▲ |
| |
| | Jörg Sellmeyer | Mach still time that here
Also nützt you that here:
nothing, circa evtl. a Error abzufangen, there your Program so or so weitermacht. If, then a reasonable iF-request in the You too a alternative program. means a Messagebox "Falscher Pfad" or something like.
You spring with ChDir into Ordner mere. It can well his, that this therefore blockiert and is You first delete can, if you again from the Ordner rausgehst: ChDir ".."
Erase is a old DOS-commands. Very effectively but too with caution To enjoy, if one not auskennt. Gib in the DOS-Window Help /erase one. |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 07/25/11 ▲ |
| |
| | | @Jörg: I faith you mean deltree instead of erase ?! Erase Gibts but too and /s ists How deltree -
my News XP knows deltree ("""leider""") not any more.
@Julian: simply to Your ChooseDir$ time one print getDir$("@") in order to look whether ChooseDir$ whom way changes.
Why a File/ Ordner not Remove can... ever one Process becomes hold yet on the or in the directory rumwuseln and a handle hold - vlt. the Explorer the on its versteckten thumbs.db glue or one AV-Program or one Indizierungsdienst or or or... use testweise The addFile.DLL How in the example too time by external instead of by importdll circa too to exclude whether I there forget have a handle To close. |
| | | | |
| | | | | | | |
| | | you mean whether the Ordner another user heard or the user no Lösch-right own? |
| | | | |
| | Jörg Sellmeyer | Yes - meant naturally deltree. Sorry... |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 07/25/11 ▲ |
| |
| | Julian Schmidt | Jörg Sellmeyer (25.07.11)
Also nützt you that here: nothing, circa evtl. a Error abzufangen, there your Program so or so weitermacht. If, then a reasonable iF-request in the You too a alternative program. means a Messagebox "Falscher Pfad" or something like.
cls
delete_folder_completely("C:\\Test")
'delete_folder_completely(ChooseDir$("Verzeichnis dial:"))
Proc delete_folder_completely
Parameters way$
declare Error%,z%,h&
var addfiles.dll&=ImportDLL("addfiles.dll","")
while 1
if DirExists(way$)
h&=Create("List", 0)
Chdir way$
if @$ GetDir("@")=way$
AddFiles("*.*",h&,1)
MoveListToHandle(h&)
whileloop GetCount(h&)
if Left$(GetString$(h&,&loop-1),Len(way$))=way$
if FileExists(GetString$(h&,&loop-1))
Erase GetString$(h&,&loop-1)
if FileExists(GetString$(h&,&loop-1))
Messagebox("Die File '"+GetString$(h&,&loop-1)+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
Endif
Endwhile
clearlist h&
Chdir way$
if @$ GetDir("@")=way$
AddDirs("*.*",h&,1)
whileloop GetCount(h&),1,-1
if Left$(GetString$(h&,&loop-1),Len(way$))=way$
if DirExists(GetString$(h&,&loop-1))
RmDir GetString$(h&,&loop-1)
if DirExists(GetString$(h&,&loop-1))
Messagebox("Das directory '"+GetString$(h&,&loop-1)+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
Endif
Endwhile
if @$ GetDir("@")=way$
if DirExists(way$)
RmDir way$
if DirExists(way$)
Messagebox("Das directory '"+way$+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' isn't vorhanden","ERROR",16)
Endif
if Error%=0
break
else
z%=Messagebox("Das Delete the Ordnes '"+way$+"' wasn't successful! want tappt im dunkeln it repeat?","INFO",5+64+256+4096)
if z%=4
Error%=0
else
break
Endif
Endif
Endwhile
destroywindow(h&)
FreeDLL addfiles.dll&
ENDPROC
Jörg Sellmeyer (25.07.11)
You spring with ChDir into Ordner mere. It can well his, that this therefore blockiert and is You first delete can, if you again from the Ordner rausgehst: ChDir ".."
How could I something like into code include?
iF (25.07.11)
Why a File/ Ordner not Remove can... ever one Process becomes hold yet on the or in the directory rumwuseln and a handle hold - vlt. the Explorer the on its versteckten thumbs.db glue or one AV-Program or one Indizierungsdienst
the have I already vermutet! I have therefore attempts whom Ordner freizugeben, whom computer neugestartet, Explorer.exe exits. thereafter went it, How before ditto not! subsequently have I over Unlocker screen whether a Process whom Ordner uses. The said me the it not usage is! After one further Test the Löschens went it again not. lying about on the Source, or. on RmDir? or because XProfan self this Ordner blockiert.
iF (25.07.11)
or or or... use testweise The addFile.DLL How in the example too time by external instead of by importdll circa too to exclude whether I there forget have a handle To close.
Do I The DLL before it yet iwie integrate [UseDLL or so?]? |
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/25/11 ▲ |
| |
| | | | | | | |
| | Julian Schmidt | About whom appeal over External comes against a Error Message. lying it vlt on it that I whom kompletten way to DLL indicate must?
delete_folder_completely("C:\\Test")
'delete_folder_completely(ChooseDir$("Verzeichnis dial:"))
Proc delete_folder_completely
Parameters way$
declare Error%,z%,h&
'var addfiles.dll&=ImportDLL("addfiles.dll","")
while 1
if DirExists(way$)
h&=Create("List", 0)
Chdir way$
if @$ GetDir("@")=way$
'AddFiles("*.*",h&,1)
external("addfiles.dll","AddFiles","*.*",h&,1)
MoveListToHandle(h&)
whileloop GetCount(h&)
if Left$(GetString$(h&,&loop-1),Len(way$))=way$
if FileExists(GetString$(h&,&loop-1))
Erase GetString$(h&,&loop-1)
if FileExists(GetString$(h&,&loop-1))
Messagebox("Die File '"+GetString$(h&,&loop-1)+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
Endif
Endwhile
clearlist h&
Chdir way$
if @$ GetDir("@")=way$
'AddDirs("*.*",h&,1)
external("addfiles.dll","AddDirs","*.*",h&,1)
whileloop GetCount(h&),1,-1
if Left$(GetString$(h&,&loop-1),Len(way$))=way$
if DirExists(GetString$(h&,&loop-1))
RmDir GetString$(h&,&loop-1)
if DirExists(GetString$(h&,&loop-1))
Messagebox("Das directory '"+GetString$(h&,&loop-1)+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
Endif
Endwhile
if @$ GetDir("@")=way$
if DirExists(way$)
RmDir way$
if DirExists(way$)
Messagebox("Das directory '"+way$+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' isn't vorhanden","ERROR",16)
Endif
if Error%=0
break
else
z%=Messagebox("Das Delete the Ordnes '"+way$+"' wasn't successful! want tappt im dunkeln it repeat?","INFO",5+64+256+4096)
if z%=4
Error%=0
else
break
Endif
Endif
Endwhile
destroywindow(h&)
'FreeDLL addfiles.dll&
ENDPROC
|
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/25/11 ▲ |
| |
| | Jörg Sellmeyer |
whom kompletten way to DLL indicate must?
Do you have it already ausprobiert? |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 07/25/11 ▲ |
| |
| | Julian Schmidt | Jörg Sellmeyer (25.07.11)
Julian57 (25.07.11)whom kompletten way to DLL indicate must?
Do you have it already ausprobiert?
No goes unfortunately not.
Def DateiName(1) SubStr$(@$(1),-1,"\\")
Def DateiPfad(1) Translate$(@$(1),("\\" + DateiName(@$(1))),"")
delete_folder_completely("C:\\Test")
'delete_folder_completely(ChooseDir$("Verzeichnis dial:"))
Proc delete_folder_completely
Parameters way$
declare Error%,z%,h&
'var addfiles.dll&=ImportDLL("addfiles.dll","")
while 1
if DirExists(way$)
h&=Create("List", 0)
Chdir way$
if @$ GetDir("@")=way$
'AddFiles("*.*",h&,1)
Messagebox(DateiPfad(Par$(1)) +"\\addfiles.dll","",0)
external(DateiPfad(Par$(1)) +"\\addfiles.dll","AddFiles","*.*",h&,1)
MoveListToHandle(h&)
whileloop GetCount(h&)
if Left$(GetString$(h&,&loop-1),Len(way$))=way$
if FileExists(GetString$(h&,&loop-1))
Erase GetString$(h&,&loop-1)
if FileExists(GetString$(h&,&loop-1))
Messagebox("Die File '"+GetString$(h&,&loop-1)+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
Endif
Endwhile
clearlist h&
Chdir way$
if @$ GetDir("@")=way$
'AddDirs("*.*",h&,1)
external("addfiles.dll","AddDirs","*.*",h&,1)
whileloop GetCount(h&),1,-1
if Left$(GetString$(h&,&loop-1),Len(way$))=way$
if DirExists(GetString$(h&,&loop-1))
RmDir GetString$(h&,&loop-1)
if DirExists(GetString$(h&,&loop-1))
Messagebox("Das directory '"+GetString$(h&,&loop-1)+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
Endif
Endwhile
if @$ GetDir("@")=way$
if DirExists(way$)
RmDir way$
if DirExists(way$)
Messagebox("Das directory '"+way$+"' couldn't deleted go!","ERROR",16)
Error%=Error%+1
Endif
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' couldn't opened go!","ERROR",16)
Endif
else
Messagebox("Der way '"+way$+"' isn't vorhanden","ERROR",16)
Endif
if Error%=0
break
else
z%=Messagebox("Das Delete the Ordnes '"+way$+"' wasn't successful! want tappt im dunkeln it repeat?","INFO",5+64+256+4096)
if z%=4
Error%=0
else
break
Endif
Endif
Endwhile
destroywindow(h&)
'FreeDLL addfiles.dll&
ENDPROC
|
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/25/11 ▲ |
| |
|
AnswerTopic-Options | 30.895 Views |
Themeninformationenthis Topic has 8 subscriber: |