Multi Commander > Support and Feedback
Can't get MC.Filesystem.Delete to work
AlanJB:
--- Quote from: Mathias (Author) on July 30, 2022, 16:49:13 ---Hmm Might be to dangerous function to allow delete so easy. Maybe should require a confirmation box. ? maybe a "Do you really want to delete : <folder> ?" box ?, but the idea with script it to not have them..
--- End quote ---
@Mathias, just a thought...
You could offer the dialog by default with a "Do you really want to delete : <folder> ?" but include an optional NODIALOG parameter (similar to the Multiscript function CopyFile).
Mathias (Author):
--- Quote from: AlanJB on July 30, 2022, 18:06:51 ---
--- Quote from: Mathias (Author) on July 30, 2022, 16:49:13 ---Hmm Might be to dangerous function to allow delete so easy. Maybe should require a confirmation box. ? maybe a "Do you really want to delete : <folder> ?" box ?, but the idea with script it to not have them..
--- End quote ---
@Mathias, just a thought...
You could offer the dialog by default with a "Do you really want to delete : <folder> ?" but include an optional NODIALOG parameter (similar to the Multiscript function CopyFile).
--- End quote ---
Yes i was thinking that. problem is that MC.Explorer.Delete is really the one to use if you want a dialog. Problem is that it does not support filter.
MC.FileSystem.Delete goes directly to the filesystem layer, and should not show a UI.. But might break that principle with this, fell that it is to dangerous to not show a warning by default.
Ulfhednar:
Tried this again experimentally
D:\test1\test2\
was focus
I added 6 dummy files incl 1 zip & 1 rar to test2, used :-
--- Code: ---MC.Filesystem.Delete USE_CURRENT_SOURCEITEM FILTER="*.zip; *.rar"
--- End code ---
Log output
--- Code: ---2022-07-31 15:43:36.274 MC.FileSystem.Delete : Parameter USE_CURRENT_SOURCEITEM set. Use current source item as PATH parameter : 'D:\test1\test2\..'
2022-07-31 15:43:36.274 MC.FileSystem.Delete : Scanning folder..
2022-07-31 15:43:36.274 MC.FileSystem.Delete : Found 8 items in path
2022-07-31 15:43:36.274 MC.FileSystem.Delete : 2 Filters found
--- End code ---
D:\test1\test2\
was focus again
I added 1 zip & 1 rar to both test1 & test2 & ran button, all were deleted, re item count:-
--- Code: ---2022-07-31 15:47:22.824 MC.FileSystem.Delete : Parameter USE_CURRENT_SOURCEITEM set. Use current source item as PATH parameter : 'D:\test1\test2\..'
2022-07-31 15:47:22.824 MC.FileSystem.Delete : Scanning folder..
2022-07-31 15:47:22.824 MC.FileSystem.Delete : Found 10 items in path
2022-07-31 15:47:22.824 MC.FileSystem.Delete : 2 Filters found
--- End code ---
So I added test3 folder
D:\test1\test2\test3\
Added 2 archives to each test folder: -
With test3 in focus, archives in test 2 & test 3 were deleted
With test2 in focus, only archives in test 3 were deleted, not in 1 or 2 ???
Log shows the command thinks I am in test3 (ran this 3 times with same result, it can't tell my focus is ..\test2\
--- Code: ---2022-07-31 16:13:51.481 MC.FileSystem.Delete : Parameter USE_CURRENT_SOURCEITEM set. Use current source item as PATH parameter : 'D:\test1\test2\test3'
2022-07-31 16:13:51.481 MC.FileSystem.Delete : Scanning folder..
2022-07-31 16:13:51.481 MC.FileSystem.Delete : Found 5 items in path
2022-07-31 16:13:51.481 MC.FileSystem.Delete : 2 Filters found
--- End code ---
So quite interesting...!
A dialog could be helpful but only if the reason why the command includes other folders in such a surprising way gets caught. Would adding FILTER to MC.Explorer.Delete be easier?
But in any case, don't let this ruin your summer Mathias. ;)
AlanJB:
--- Quote from: Ulfhednar on July 31, 2022, 17:20:24 ---A dialog could be helpful but only if the reason why the command includes other folders in such a surprising way gets caught. Would adding FILTER to MC.Explorer.Delete be easier?
--- End quote ---
Now that is a good idea :D
Mathias (Author):
--- Quote from: Ulfhednar on July 31, 2022, 17:20:24 ---A dialog could be helpful but only if the reason why the command includes other folders in such a surprising way gets caught. Would adding FILTER to MC.Explorer.Delete be easier?
--- End quote ---
Adding support for Filter for for normal delete is planned but that is way more complex because that operation in done in a different way that support so much more
Somethings that I dont get.. is that if C:\Text1\test2 is current item in focus.. and you use USE_CURRENT_SOURCEITEM. How you get D:\test1\test2\.. because ".." is only available if you are located INSIDE test2, When set test2 as item in focus then you are standing in Test1 folder. The only reason I can see this happening is that panel that are in focus is the other panel.. and you are showing the content of test2 and the focus item in that panel is the ".." item.
However ".." should not be possible to select.. I will block that.. if focus is on ".." it should not continue. else it will scan up the tree..
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version