English
Forum

directory with everything encompassed Files and Unterverzeichnissen (restlos) delete

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


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  
 



Rekursives AddFiles by XProfans AddFiles-function or over The AddFiles.Dll (  [...]  ) and any gelisteten Files delete and subsequently one AddDirs (from AddFiles.Dll) and any directories Remove. You must always of it go out the itself a File/ directory not Remove can.
 
07/24/11  
 




Julian
Schmidt
thanks IF,
my View source so functions so far, To hereon the the Ausgangsordner self not deleted becomes. lying it vlt on it the the Explorer or another Process this blockiert. can you whom View source testing?
delete_folder_completely("D:\Test")
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$
    AddFiles("*.*",h&,1)
    MoveListToHandle(h&)

    whileloop GetCount(h&)

        Erase GetString$(h&,&loop-1)

    Endwhile

    clearlist h&
    Chdir way$
    AddDirs("*.*",h&,1)

    whileloop GetCount(h&),1,-1

        RmDir GetString$(h&,&loop-1)

    Endwhile

    destroywindow(h&)
    RmDir way$
    FreeDLL addfiles.dll&

ENDPROC


13 kB
Hochgeladen:07/24/11
Downloadcounter86
Download
 
˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗
Webseite [...] 
07/24/11  
 



XProfan 11.2.1.8a.63 Praekompiler [XPSE]
copyright (C) 1998-2010 XProfan.com, built DE.

File: c:\dev\Test.xprf
warning: Unknown Escapesequenz in Stringkonstante: "D:\Test"

[C]ompile [I]nterpr [L]ink [R]unPrc Run[E]xe [s]ource [H]ilfe

XPSE:>
 
07/24/11  
 




Julian
Schmidt
iF (24.07.11)
warning: Unknown Escapesequenz in Stringkonstante: "D:\Test"


and what should the very mean?
is about one Errors in the code?
 
˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗
Webseite [...] 
07/24/11  
 




Jörg
Sellmeyer
is only The Meckerei of XPSE, that You simple Backslash instead of double verwendest.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
07/24/11  
 




Julian
Schmidt
Well then, be I beruhigt.
nevertheless a problem.
Why comes with the View source a Error Message?


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$
    AddFiles("*.*",h&,1)
    MoveListToHandle(h&)

    whileloop GetCount(h&)

        Erase GetString$(h&,&loop-1)

    Endwhile

    clearlist h&
    Chdir way$
    AddDirs("*.*",h&,1)

    whileloop GetCount(h&),1,-1

        RmDir GetString$(h&,&loop-1)

    Endwhile

    destroywindow(h&)
    RmDir way$
    FreeDLL addfiles.dll&

ENDPROC


I have only The first row changed!
"delete_folder_completely("D:\Test")"
To
"delete_folder_completely(ChooseDir$("Verzeichnis dial:"))"


after I The row again abändere functions any again How before.
someone a idea?

[OFFTOPIC]Descargar
external Download
[/OFFTOPIC]


Nachtrag: The Ausgangsordner becomes unfortunately immernoch not deleted, even if I the computer neustarte!

211 kB
Hochgeladen:07/24/11
Downloadcounter114
Download
 
˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗
Webseite [...] 
07/24/11  
 



@Jörg: not integrally because it hieß too "Checkst You hold first yourself before You others therefore bittest z.B. your Festplatte To löschen".
 
07/24/11  
 



@Julian: you should absolutely a chdir-function produce The returns whether the Verzeichniswechsel successful was (z.B. by getDir$("@")) before You Filenames sammelst of Files The then deleted go (should). ^^
 
07/25/11  
 




Julian
Schmidt
so what in these direction?
delete_folder_completely("C:\\Test")
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&)

        Erase GetString$(h&,&loop-1)

    Endwhile

    clearlist h&
    Chdir way$
    case @$ GetDir("@")=way$ :  AddDirs("*.*",h&,1)

    whileloop GetCount(h&),1,-1

        RmDir GetString$(h&,&loop-1)

    Endwhile

    destroywindow(h&)
    case @$ GetDir("@")=way$ : RmDir way$
    FreeDLL addfiles.dll&

ENDPROC


Julian57 (24.07.11)
nevertheless a problem.
Why comes with the View source a Error Message?


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$
    AddFiles("*.*",h&,1)
    MoveListToHandle(h&)

    whileloop GetCount(h&)

        Erase GetString$(h&,&loop-1)

    Endwhile

    clearlist h&
    Chdir way$
    AddDirs("*.*",h&,1)

    whileloop GetCount(h&),1,-1

        RmDir GetString$(h&,&loop-1)

    Endwhile

    destroywindow(h&)
    RmDir way$
    FreeDLL addfiles.dll&

ENDPROC


I have only The first row changed!
"delete_folder_completely("D:\Test")"
To
"delete_folder_completely(ChooseDir$("Verzeichnis dial:"))"


after I The row again abändere functions any again How before.
someone a idea?

[OFFTOPIC]Descargar
external Download
[/OFFTOPIC]


Nachtrag: The Ausgangsordner becomes unfortunately immernoch not deleted (entire geleert, but not any more), even if I the computer Neustarte!
 
˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗
Webseite [...] 
07/25/11  
 




ByteAttack
already time with deltree probiert?
 
Website:  [...] 
Facebook:  [...] 
07/25/11  
 




Thomas
Freier
means, wenn's the wastebasket his must, and not utterly restlos his should, is with Erase neither the case :
'from the MMJ-Quellcodesammlung (Dietmar horn)
'File in whom wastebasket move
'executable ex Profan-Version 5.0
' PRFellow-Presentation
' Author: Thomas Hölzer
' an File in whom wastebasket move (ex Profan 5.0-32)
' Parameter:
' (1): Voller Pfadname
' (2): 1, if Bestätigungs-dialog showing should
' an Return <> 0 markiert a Error or User-discontinue
Def SHFileOperation(1) !"SHELL32","SHFileOperationA"
Declare SHFO#
Declare file#

Proc MoveFileToBin

    Parameters file$,confirm%
    Declare flags%, result&
    FindFirst$(file$)
    Case %IOResult: Return -1
    Let flags%=64
    Case confirm%: flags%=80
    Dim SHFO#,30
    Dim file#,Len(file$)+2
    String file#,0=file$
    Long SHFO#,0=GetActiveWindow()
    Long SHFO#,4=3
    Long SHFO#,8=file#
    Long SHFO#,12=0
    Word SHFO#,16=flags%
    Long SHFO#,18=0
    Long SHFO#,22=0
    Long SHFO#,26=0
    result&=SHFileOperation(SHFO#)
    Dispose file#
    Dispose SHFO#
    Return result&

ENDPROC

' example
Cls
print MoveFileToBin("C:\\TEST\\Test.txt",1)' only time so
print MoveFileToBin("C:\\TEST",1)
waitinput
 
Gruß Thomas
Windows XP SP2, XProfan X2
07/25/11  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

30.919 Views

Untitledvor 0 min.
E.T.11/22/23
Georg01/21/21
AndreasS12/23/18
Klaus Ernst01/09/18
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie