Copy file-bytesize to command-line

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Ulf
Junior Member
Junior Member
Posts: 8
Joined: 2008-09-26, 20:11 UTC

Copy file-bytesize to command-line

Post by *Ulf »

Is there any way to retrieve the bytesize of a file, much in the way one can use Ctrl+Enter to get a file name and Ctrl+Shift+Enter to get the file path?

If not, is there some addon for it?

If no addon, is it hard to create such an addon and bind it to some shortkey?

I am often in need of copying the bytesize of a certain file to the Windows clipboard.
User avatar
Flint
Power Member
Power Member
Posts: 3506
Joined: 2003-10-27, 09:25 UTC
Location: Belgrade, Serbia
Contact:

Post by *Flint »

Ulf
No, there is no simple build-in way of copying the size. However, you can use the command cm_CopyFileDetailsToClip to copy all the file details (including size) into clipboard. Actually, it's possible to write a script to extract this size only, but I'm not a script expert…
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 11.03 / Win10 x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Hi Ulf, welcome to the forum.

Work around 1.)
Windows standard Alt+Enter on file opens properties dialog
from where you can select and Ctrl+C the file size

Work around 2.)
Or open DOS-Box in current dir, select and copy the file size


Work around 3.)
Button or user command:

%comspec% /c
FOR %%I IN (%N) DO @echo %%~zI |cb


Download CB f.ex. from http://www.autohotkey.com/wiki/index.php?title=Command_Line_Utilities
and put it in your path.


HTH? :wink:


Thanks to sheepdog for various 'for' lessons
Ulf
Junior Member
Junior Member
Posts: 8
Joined: 2008-09-26, 20:11 UTC

Post by *Ulf »

Hello and thanks for the feedback!

The cm_CopyFileDetailsToClip command seems like a good way forward.

You mentioned there is a possibility to script the extraction of the filesize only. How do I proceed?

Maybe I could request a cm_CopyFileBytesizeToClip?

Regards,
Ulf, Sweden
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Ulf,
AHK script:

Code: Select all

#IfWinActive, ahk_class TTOTAL_CMD
^+s::
	Clipboard =
	PostMessage, 1075, 2018
	ClipWait
	FileGetSize, Size, %Clipboard%
	Clipboard = %Size%
	Size =
Return
Activates with Ctrl-Shift-S.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply