FsStatusInfo+FsDeleteFile - DEL multiple files one command

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
jaco777
Junior Member
Junior Member
Posts: 19
Joined: 2015-03-23, 21:56 UTC
Location: Poland
Contact:

FsStatusInfo+FsDeleteFile - DEL multiple files one command

Post by *jaco777 »

Hello.

It's me again :wink: with my plug (in Delphi 7).
I can once again be a trivial question, but a solution that I come to mind are hopeless.

As before ( http://ghisler.ch/board/viewtopic.php?t=41977&highlight= ), tried to get the status of the selection delete multiple files with FsStatusInfo. But FsStatusInfo always returns FS_STATUS_OP_DELETE, for one the deleted file and for many erased files.
Is a command Cm_CopyNamesToClip, but it uses the system clipboard, and this is a bad solution.

The question:
Is it possible to get a list of selected files to delete and execute FsDeleteFile only once (not as many times as marked files)?


To Moderators: if you need, move to my previous post http://ghisler.ch/board/viewtopic.php?t=41977&highlight=
User avatar
Dalai
Power Member
Power Member
Posts: 9960
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

According to the plugin SDK this is not possible. TC will call FsDeleteFile once for every file. It's the same for FsGetFile, even though there is a flag FS_STATUS_OP_GET_MULTI in FsStatusInfo. TC and the plugin must know the exact file names the operation is about, so the RemoteName variable can contain only one file name.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
jaco777
Junior Member
Junior Member
Posts: 19
Joined: 2015-03-23, 21:56 UTC
Location: Poland
Contact:

Post by *jaco777 »

I'm sorry that I did not answer for so long.

Thanks for the detailed explanation.

I will try to even the creation of a list of files in FsDeleteFile and only at the end, I'll send the POST to the server with the entire list of files.

PS.
Is it possible to get a list of selected files ?
User avatar
Dalai
Power Member
Power Member
Posts: 9960
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Maybe you can make use of FsStatusInfo, but currently I'm not sure whether FsStatusInfo is called with FS_STATUS_START and FS_STATUS_OP_DELETE flags once for the whole operation or once per file - you may try that out using the debugger.

Anyway, here's what I have in mind:
If FsStatusInfo gets called with FS_STATUS_START and FS_STATUS_OP_DELETE, clear your list of files (e.g. TStringList), and set some global boolean variable (e.g. DeleteActive).
Furthermore, in FsStatusInfo, if called with FS_STATUS_END and FS_STATUS_OP_DELETE, you delete all files that are in the list, and set the boolean variable to false.

In FsDeleteFile, you check this boolean variable, and if it's true, you add the file to your list and return true.

Please note that the length of the delete command you send to the server may be limited, so it doesn't get all file names if the command line is too long. So, you might want to check the server documentation whether there is such a limit.

Hope that helps.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply