Forum | | | | - Page 1 - |
| Julian Schmidt | How can a directory on the elegantesten with all Unterverzeichnissen and everything encompassed Files delete? |
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/24/11 ▲ |
| |
| | « 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 ▲ |
| | |
| | | | | - Page 2 - |
| 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 ▲ |
| |
| | | | - Page 3 - |
| | 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 ▲ |
| |
| | Jörg Sellmeyer | Why make You it you (and us) so heavy? You want still only rauskriegen, whether You The Dll correctly. lädtst. means simply time a minimalsten code, in the You The Dll load and a action ausführst: Why should we The Help to Dll durchlesen, if you not make? there should The Parameter stand, The each functions expect and the Profanhilfe standing, How the appeal with External functions. you should no functions on The Dllaufrufe transfer, separate variables. means not:
instead so:
and sincere said: your nested If-structure understand I none
you mußt still only to check on, whether the directory, the your Löschprozedur with Parameters transfer becomes, present is. means something so:
with the way to Dll: it depends of it ex, where tappt im dunkeln itself befindet. as they in the Windowsordner or another Ordner in the Systempfad is, becomes tappt im dunkeln directly found. as they in the Programmordner Your Program lying, becomes tappt im dunkeln too found. important hierbei: as long as You entwickelst and Prf-Files launch, is evtl. the Profanordner the Programmordner! as they irgendwoanders lying, must the way indicated go. Mach a three- To Fünfzeiler what about me teste gladly. |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 07/26/11 ▲ |
| |
| | | Jörg Sellmeyer (26.07.11)
I faith You meant External instead of DateiPfad:
@Julian: Presumably would it "ordentlicher" if you The DLL(s) The You benötigst with Nichtvorhandensein to appdata/roflmao ablegst and there also load. |
| | | | |
| | 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 ▲ |
| |
| | Julian Schmidt | Dieter Zornow (26.07.11)
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 whom 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
very such a thing have I sought! |
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/26/11 ▲ |
| |
| | E.T. | | | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 07/26/11 ▲ |
| |
| | Julian Schmidt | i will The Files indeed not wastebasket move. ^^ About Forum have I only "Verzeichnis" sought. and over Strg+F subsequently to "Delete", "loeschen" sought, where not the I sought found watts... |
| | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...] | 07/26/11 ▲ |
| |
| | | Jupp, wasn't simply to find -
therefore make I me always The trouble such Source with relevanten Suchbegriffen To slip circa einzusortieren. |
| | | | |
|
AnswerTopic-Options | 30.889 Views |
Themeninformationenthis Topic has 8 subscriber: |