![]() |
Löschen von files , by Name Pattern
kann ich mit diesem code
Delphi-Quellcode:
function DeleteFiles(const AFile: string): boolean;
var sh: SHFileOpStruct; begin ZeroMemory(@sh, SizeOf(sh)); with sh do begin Wnd := Application.Handle; wFunc := FO_DELETE; pFrom := PChar(AFile +#0); fFlags := FOF_SILENT or FOF_NOCONFIRMATION; end; result := SHFileOperation(sh) = 0; end; auch files mit einem Namen Pattern löschen wie
Aktuell macht die Funktion nicht so wie ich es will .... |
AW: Löschen von files , by Name Pattern
Du hast dir die Frage doch schon selbst beantwortet: Nein.
|
AW: Löschen von files , by Name Pattern
gibt es eine einfache Lösung / existierende Lösung ?
|
AW: Löschen von files , by Name Pattern
Also eigentlich sollte das funktionieren, denn
![]() Zitat:
Grüße Dalai |
AW: Löschen von files , by Name Pattern
Problem gelöst, war ein Fehler in meinem Pattern ...
|
AW: Löschen von files , by Name Pattern
Zitat:
SHFileOperation hat ca. 20 unterschiedliche Rückgabewerte. Du prüfst aber nur, ob kein Fehler aufgetreten ist. Eventuell fragst Du da ja mal etwas genauer ab, um zu erfahren, was denn da so eventuell schiefgelaufen sein könnte. ![]()
Delphi-Quellcode:
function DeleteFiles(const AFile: string): boolean; var sh: SHFileOpStruct; begin Result := false; ZeroMemory(@sh, SizeOf(sh)); with sh do begin Wnd := Application.Handle; wFunc := FO_DELETE; pFrom := PChar(AFile +#0); fFlags := FOF_SILENT or FOF_NOCONFIRMATION; end; case SHFileOperation(sh) of 0 : result := True; $71 : ShowMessage('The source and destination files are the same file.'); $72 : ShowMessage('Multiple file paths were specified in the source buffer, but only one destination file path.'); $73 : ShowMessage('Rename operation was specified but the destination path is a different directory. Use the move operation instead.'); $74 : ShowMessage('The source is a root directory, which cannot be moved or renamed.'); $75 : ShowMessage('The operation was canceled by the user, or silently canceled if the appropriate flags were supplied to SHFileOperation.'); $76 : ShowMessage('The destination is a subtree of the source.'); $78 : ShowMessage('Security settings denied access to the source.'); $79 : ShowMessage('The source or destination path exceeded or would exceed MAX_PATH.'); $7A : ShowMessage('The operation involved multiple destination paths, which can fail in the case of a move operation.'); $7C : ShowMessage('The path in the source or destination or both was invalid.'); $7D : ShowMessage('The source and destination have the same parent folder.'); $7E : ShowMessage('The destination path is an existing file.'); $80 : ShowMessage('The destination path is an existing folder.'); $81 : ShowMessage('The name of the file exceeds MAX_PATH.'); $82 : ShowMessage('The destination is a read-only CD-ROM, possibly unformatted.'); $83 : ShowMessage('The destination is a read-only DVD, possibly unformatted.'); $84 : ShowMessage('The destination is a writable CD-ROM, possibly unformatted.'); $85 : ShowMessage('The file involved in the operation is too large for the destination media or file system.'); $86 : ShowMessage('The source is a read-only CD-ROM, possibly unformatted.'); $87 : ShowMessage('The source is a read-only DVD, possibly unformatted.'); $88 : ShowMessage('The source is a writable CD-ROM, possibly unformatted.'); $B7 : ShowMessage('MAX_PATH was exceeded during the operation.'); $402 : ShowMessage('An unknown error occurred. This is typically due to an invalid path in the source or destination. This error does not occur on Windows Vista and later.'); $10000 : ShowMessage('An unspecified error occurred on the destination.'); $10074 : ShowMessage('Destination is a root directory and cannot be renamed.'); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:53 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz