|
From: relaxmike on 2 Jul 2008 15:44 Hi all, I just quit my previous job and had to free some space on my hard drive, which contains here and there some large data files. To locate these large files and process them (zip or trash), I first used the excellent "dirsize" script from the wiki : http://wiki.tcl.tk/13978 But "dirsize" focus on directories, not files. So I tried to script my own tool, which searches for files larger than a given limit with the "find" command of the fileutil package of Tcllib. The matching files are then sorted by decreasing size, so that largest files appear first. The final task is to display the sorted list, with a human readable file size. I released the final version on the wiki : http://wiki.tcl.tk/21295 The first part of the work was to compute a human readable file size. I asked for better references in a previous thread : http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/6786e7ac38f7a3bb/6099ccc726329006?lnk=gst&q=find+large+files#6099ccc726329006 which indicated that an algorithm designed by RS is available on the wiki : http://wiki.tcl.tk/10874 The tool is not as simple as I previously think, because of the two possible unit systems (decimal and binary), and also because taking into account large files implied overcoming the limits of the "expr" command, even if "file stat" returns a consistent value : http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/1c0ca1d66a69a7d1/00bba80a9722f472?lnk=gst&q=file+size#00bba80a9722f472 I used the "bigfloat" package of the tcllib, and the result is working fine. There are remaining questions that I would want to ask. Is there other Tcl-based tools to locate large files on a hard drive ? The bigfloat package provides a special version for Tcl 8.5. I read the doc of bigfloat at : http://tcllib.sourceforge.net/doc/bigfloat.html#SECTid820a7b0 but that is not clear for me yet. Does support for large integers (64 bits ?) was included in Tcl 8.5 ? Regards, Michaël
From: Kaitzschu on 2 Jul 2008 19:07 On Wed, 2 Jul 2008, relaxmike wrote: > The bigfloat package provides a special version for Tcl 8.5. I read the > doc of bigfloat at : > > http://tcllib.sourceforge.net/doc/bigfloat.html#SECTid820a7b0 > > but that is not clear for me yet. Does support for large integers (64 > bits ?) was included in Tcl 8.5 ? Actually better, TIP#237 [1] provided Tcl 8.5 with near-arbitrary precision integers. I haven't so far quite grasped whether or not this improvement renders wide() function obsolete, but at least Tcl has now no problems [2] calculating such small numbers as 2**10000 (although I'm _not_ going to calculate that by hand to check whether "expr 2**10000" is giving the correct answer :) 1: http://www.tcl.tk/cgi-bin/tct/tip/237.html 2: this does not apply to floating point numbers -- -Kaitzschu set s TCL\ ;wh 1 {pu [set s [st ra $s 1 3][st in $s 0]]\033\[1A;af 99} "Good thing programmers don't build bridges [the same way as Kaitzschu writes code]." --John Kelly in comp.lang.tcl
From: Alexandre Ferrieux on 2 Jul 2008 19:27 On Jul 2, 9:44 pm, relaxmike <michael.bau...(a)gmail.com> wrote: > Hi all, > > I just quit my previous job and had to free some space > on my hard drive, which contains here and there some large data > files. > To locate these large files and process them (zip or trash), > I first used the excellent "dirsize" script from the wiki :http://wiki.tcl..tk/13978 > But "dirsize" focus on directories, not files. > > So I tried to script my own tool, which searches for files > larger than a given limit with the "find" command of the fileutil > package > of Tcllib. The matching files are then sorted > by decreasing size, so that largest files appear first. > The final task is to display the sorted list, with a human > readable file size. > I released the final version on the wiki : > > http://wiki.tcl.tk/21295 > > The first part of the work was to compute a human readable > file size. I asked for better references in a previous thread : > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/678... > > which indicated that an algorithm designed by RS is available on the > wiki : > > http://wiki.tcl.tk/10874 > > The tool is not as simple as I previously think, > because of the two possible unit systems (decimal and binary), > and also because taking into account large files implied > overcoming the limits of the "expr" command, even if > "file stat" returns a consistent value : > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/1c0... > > I used the "bigfloat" package of the tcllib, and the result is working > fine. > > There are remaining questions that I would want to ask. > > Is there other Tcl-based tools to locate large files on a hard drive ? > > The bigfloat package provides a special version for Tcl 8.5. > I read the doc of bigfloat at : > > http://tcllib.sourceforge.net/doc/bigfloat.html#SECTid820a7b0 > > but that is not clear for me yet. Does support for > large integers (64 bits ?) was included in Tcl 8.5 ? > > Regards, > > Michaël FWIW, the excellent SequoiaView gives you an unprecedented 2D representation of disk space (smartly arranged "cushions"). Doing it in Tcl is certainly interesting, but if all you're after is finding the space-eaters, a dedicated tool is unbeatable... -Alex
From: rf on 3 Jul 2008 02:23 On Jul 2, 9:44 pm, relaxmike <michael.bau...(a)gmail.com> wrote: > Hi all, > > I just quit my previous job and had to free some space > on my hard drive, which contains here and there some large data > files. > To locate these large files and process them (zip or trash), > I first used the excellent "dirsize" script from the wiki :http://wiki.tcl..tk/13978 > But "dirsize" focus on directories, not files. > > So I tried to script my own tool, which searches for files > larger than a given limit with the "find" command of the fileutil > package > of Tcllib. The matching files are then sorted > by decreasing size, so that largest files appear first. > The final task is to display the sorted list, with a human > readable file size. > I released the final version on the wiki : > > http://wiki.tcl.tk/21295 > > The first part of the work was to compute a human readable > file size. I asked for better references in a previous thread : > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/678... > > which indicated that an algorithm designed by RS is available on the > wiki : > > http://wiki.tcl.tk/10874 > > The tool is not as simple as I previously think, > because of the two possible unit systems (decimal and binary), > and also because taking into account large files implied > overcoming the limits of the "expr" command, even if > "file stat" returns a consistent value : > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/1c0... > > I used the "bigfloat" package of the tcllib, and the result is working > fine. > > There are remaining questions that I would want to ask. > > Is there other Tcl-based tools to locate large files on a hard drive ? > > The bigfloat package provides a special version for Tcl 8.5. > I read the doc of bigfloat at : > > http://tcllib.sourceforge.net/doc/bigfloat.html#SECTid820a7b0 > > but that is not clear for me yet. Does support for > large integers (64 bits ?) was included in Tcl 8.5 ? > > Regards, > > Michaël a Tk based tool called Tktreemap, similar to Sequioview, is presented at http://wiki.tcl.tk/12528 -roland frank
From: relaxmike on 3 Jul 2008 04:41 Thank you all for these answers. I updated the wiki pages for Tktreemap, Directory size and file size so that they all refer to each other, to get a complete view on the subject. Tktreemap is interesting indeed and the treemap viewing method itself is of more general impact. Is there a general Tcl package to manage treemaps, associated to file sizes or not ? Another question I asked myself is if there is a Tcl snippet to compute the size of one directory ? In fact, the "DirSize_Recurs" from the "directory size" script deals both with file sizes and the colors displayed in the GUI. That should not be complicated to extract the general algorithm anyway. Michaël On 3 juil, 08:23, rf <roland.fr...(a)free.fr> wrote: > On Jul 2, 9:44 pm, relaxmike <michael.bau...(a)gmail.com> wrote: > > > > > Hi all, > > > I just quit my previous job and had to free some space > > on my hard drive, which contains here and there some large data > > files. > > To locate these large files and process them (zip or trash), > > I first used the excellent "dirsize" script from the wiki :http://wiki.tcl.tk/13978 > > But "dirsize" focus on directories, not files. > > > So I tried to script my own tool, which searches for files > > larger than a given limit with the "find" command of the fileutil > > package > > of Tcllib. The matching files are then sorted > > by decreasing size, so that largest files appear first. > > The final task is to display the sorted list, with a human > > readable file size. > > I released the final version on the wiki : > > >http://wiki.tcl.tk/21295 > > > The first part of the work was to compute a human readable > > file size. I asked for better references in a previous thread : > > >http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/678... > > > which indicated that an algorithm designed by RS is available on the > > wiki : > > >http://wiki.tcl.tk/10874 > > > The tool is not as simple as I previously think, > > because of the two possible unit systems (decimal and binary), > > and also because taking into account large files implied > > overcoming the limits of the "expr" command, even if > > "file stat" returns a consistent value : > > >http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/1c0... > > > I used the "bigfloat" package of the tcllib, and the result is working > > fine. > > > There are remaining questions that I would want to ask. > > > Is there other Tcl-based tools to locate large files on a hard drive ? > > > The bigfloat package provides a special version for Tcl 8.5. > > I read the doc of bigfloat at : > > >http://tcllib.sourceforge.net/doc/bigfloat.html#SECTid820a7b0 > > > but that is not clear for me yet. Does support for > > large integers (64 bits ?) was included in Tcl 8.5 ? > > > Regards, > > > Michaël > > a Tk based tool called Tktreemap, similar to Sequioview, is presented > athttp://wiki.tcl.tk/12528 > -roland frank
|
Pages: 1 Prev: Tcl-URL! - weekly Tcl news and links (Jul 2) Next: Tk focus model in 8.5 on Windows XP |