I want to know total size of files when deleting something. Is it possible? I think XYplorer is able to do this, but I didn't find any option.
Possible to show size when deleteing
-
fogg
- Posts: 32
- Joined: 15 Jul 2014 16:13
- Location: Going around the World
Possible to show size when deleteing
Hello,
I want to know total size of files when deleting something. Is it possible? I think XYplorer is able to do this, but I didn't find any option.
I want to know total size of files when deleting something. Is it possible? I think XYplorer is able to do this, but I didn't find any option.
s404:signature not found.
-
admin
- Site Admin
- Posts: 66297
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Possible to show size when deleteing
Try this. You'll get a confirmation before the actual delete confirmation. Safety belt.
This will display total size of all selected files and folders before deleting, so sometimes the calculation might take sometime. (Although in my short tests the performance was surprisingly fast!
)
Now You know there are different shortcuts for different types of deletions? (delete skip locked, delete without recycling,...) Well, how about making this behave like another extra mode? Just assign it a shortcut with delete button! Here's how.
Code: Select all
$focus = get('FocusedControl');
$items = ($focus == 'T') ? <curpath> : ( ($focus == 'L') ? get('SelectedItemsPathNames', '|') : '' ) ;
end ($items == '');
unset $focus;
$grandsize = 0; $size = 0;
foreach ($item, $items, '|'){
$size = (exists($item) != 1) ? foldersize($item, '<r>', 1) : filesize($item) ;
$grandsize = $grandsize + $size;
}
$grandsize = formatbytes($grandsize, 'FLEX');
$ques = "You're about to delete $grandsize in total.<crlf 2>Continue?";
if (confirm($ques,,,4/**btns:Yes/No*/) == 1){ #169 ;/*File > Delete*/ }Now You know there are different shortcuts for different types of deletions? (delete skip locked, delete without recycling,...) Well, how about making this behave like another extra mode? Just assign it a shortcut with delete button! Here's how.
- Open Main Menu > User > Manage commands
- pick the "Run script" category.
- Click New > add new command (or just press INSERT key) .
- Enter "Delete (show total size)" in the "Caption" box. Or enter whatever you want to call it.
- Press the EDIT button beside "Script" box. In the opened textbox, paste the whole script above. (make sure the spaces are there before each line)
- "OK" out out of there.
- Now set up a hotkey with "Assign keyboard shortcut" button. Press that button, then press DELETE key to jump to free shortcuts with DELETE.
I suggest you also check "On keyup"
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
fogg
- Posts: 32
- Joined: 15 Jul 2014 16:13
- Location: Going around the World
Re: Possible to show size when deleteing
Thanks, but That is not quick, I need to use that menu, then again do delete.admin wrote:Edit | Select | Selection Stats?
s404:signature not found.
-
admin
- Site Admin
- Posts: 66297
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Possible to show size when deleteing
Did you see Sammay's reply: http://www.xyplorer.com/xyfc/viewtopic. ... 83#p121083
FAQ | XY News RSS | XY X
-
fogg
- Posts: 32
- Joined: 15 Jul 2014 16:13
- Location: Going around the World
Re: Possible to show size when deleteing
I use the Ctrl+Del for this script because I don't use Delete (Skip Locked) #171
But can it delete with only one confirmation?
Again Many thanks,
Phil
s404:signature not found.
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Possible to show size when deleteing
My pleasure.
with this:Again make sure there's (at least) one space at the beginning of the line.
This will delete selected items to recycle bin. Replace the 1 after "delete" to 0 to delete permanently; I don't suggest that though.
Sure. Replace the very last line,fogg wrote:But can it delete with only one confirmation?
Code: Select all
if (confirm($ques,,,4/**btns:Yes/No*/) == 1){ #169 ;/*File > Delete*/ }Code: Select all
if (confirm($ques,,,4/**btns:Yes/No*/) == 1){ delete 1, 0, $items; }This will delete selected items to recycle bin. Replace the 1 after "delete" to 0 to delete permanently; I don't suggest that though.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
fogg
- Posts: 32
- Joined: 15 Jul 2014 16:13
- Location: Going around the World
-
fogg
- Posts: 32
- Joined: 15 Jul 2014 16:13
- Location: Going around the World
Re: Possible to show size when deleteing
Hello again.
I have a problem. nothing happens When I press control + delete to open this script. Next time, it opens a message box saying

I have a problem. nothing happens When I press control + delete to open this script. Next time, it opens a message box saying
Code: Select all
a user-defiend command (#1403) is not allowed to call itselfs404:signature not found.
-
fogg
- Posts: 32
- Joined: 15 Jul 2014 16:13
- Location: Going around the World
Re: Possible to show size when deleteing
more: also short time later opens a script error box as
Code: Select all
Access is denieds404:signature not found.
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Possible to show size when deleteing
This is because you'd selected a really huge folder and XY needed some time to calculate the total size. But you called the script again meanwhile, without letting the previous instance finish it's calculation.fogg wrote:Hello again.
I have a problem. nothing happens When I press control + delete to open this script. Next time, it opens a message box sayingCode: Select all
a user-defined command (#1403) is not allowed to call itself![]()
![]()
So if this happens again, remember that the script hasn't died fighting an error but just needs more time.
Also remember, to stop calculation at any time, press ESC (twice).
You selected something that XY cannot delete. Say maybe a hard disk Drive root, C:\, D:\ ... ? (that's where I got the same result) Y'know, In this case even for usual deletion XY displays an alert, which is not much less alarming than an scripting error.fogg wrote:more: also short time later opens a script error box asCode: Select all
Access is denied
Hmm, the script better not calculate at all when drives are selected, but another solution is: just don't trigger it on whole drives!
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
PeterH
- Posts: 2827
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Possible to show size when deleteing
@Sammay: show per Status cmd that script is working, and then when it's finished?
(Use Color to clearly show progress state.)
This at least gives some hint to the user.
(Use Color to clearly show progress state.)
This at least gives some hint to the user.
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Possible to show size when deleteing
I tried it, but since size of each selected folder/file is calculated in a single statement, status update will still seem to freeze/stutter if that folder happens to be large.
Anyways, here's that script with periodic updates:
Anyways, here's that script with periodic updates:
Code: Select all
$focus = get('FocusedControl');
$items = ($focus == 'T') ? <curpath> : ( ($focus == 'L') ? get('SelectedItemsPathNames', '|') : '' ) ;
end ($items == '');
unset $focus;
$grandsize = 0; $size = 0;
foreach ($item, $items, '|'){
$size = (exists($item) != 1) ? foldersize($item, '<r>', 1) : filesize($item) ;
$grandsize = $grandsize + $size;
status "calculated size: " . $grandsize ,, 'progress';
}
$grandsize = formatbytes($grandsize, 'FLEX');
$ques = "You're about to delete $grandsize in total.<crlf 2>Continue?";
if (confirm($ques,,,4/*btns:Yes/No*/) == 1){ #169 ;/*File > Delete*/ }Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Re: Possible to show size when deleteing
SammaySarkar, can you please modify script with extra safety to check if Delete is happening on non-hard drives and taking it to user's notice?
like having a variable with list of hard-drive letters user has, and if any is present in pathes, add extra line to that Question-dialog, stating that "Delete on < G > drive, will be permanent!"
like having a variable with list of hard-drive letters user has, and if any is present in pathes, add extra line to that Question-dialog, stating that "Delete on < G > drive, will be permanent!"
Win 7 SP1 x64 100% 1366x768|1900x1080
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Re: Possible to show size when deleteing
modified script myself, maybe someone will find it useful too(just use your hard-drive letters). i'd only wish i could "use bbcode" to mark some words with bold or underline..
now shows size, number of items, drive letter and additional warning if it's not stated drives.
now shows size, number of items, drive letter and additional warning if it's not stated drives.
Code: Select all
$focus = get('FocusedControl');
$items = ($focus == 'T') ? <curpath> : ( ($focus == 'L') ? get('SelectedItemsPathNames', '|') : '' ) ;
end ($items == '');
$drive = substr("<curpath>", , 1); //check for letter
if ($drive == "C" || $drive == "D" || $drive == "E" || $drive == "F") {$warning = ''} else {$warning = "This will be PERMANENT!<crlf>"};
unset $focus;
$grandsize = 0; $size = 0; $num = 0;
foreach ($item, $items, '|'){
$size = (exists($item) != 1) ? foldersize($item, '<r>', 1) : filesize($item) ;
$grandsize = $grandsize + $size;
$num++;
status "calculated size: " . $grandsize ,, 'progress'; }
$grandsize = formatbytes($grandsize, 'FLEX');
$ques = "You're about to delete $num items <crlf>$grandsize from = $drive:\ <crlf 2>$warning Continue?";
if ($warning != '') {beep 2000, 50; beep 2000, 50;};
if (confirm($ques,,,4/**btns:Yes/No*/) == 1){ delete 1, 0, $items; } //to RecycleWin 7 SP1 x64 100% 1366x768|1900x1080
XYplorer Beta Club