For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Searching through all the files in or below a directory - Ruby, Tcl, Perl
Many of our customers want to learn how to traverse all the files in a directory, or perhaps even all the files in or below
a directory. I quite often write a demonstration program during our courses which looks though part of a file system tree for files over a certain size, or for the largest (so many) files. It's a neat and useful demosntration of an application which most people can identify with.
See examples in Ruby
The method used is to keep a queue of directories to be checked in a list / array, and travese them one at a time. As new directories are found, they're added onto the end of the list / array, and as each directory is traversed, it's removed from the array, And when the array is empty, the program is done.
It's been suggested to me that when a directory is found within another ditrectory, the traversing of the parent should be suspended while the child (and any children it has) are handled. That can be done neatly through recurrsion, but the code ends up being a bit too "clever" to be easy to follow and - unless you need to traverse in a certain order - it's unnecessary. (written 2011-09-09)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesT209 - Tcl/Tk - File and Directory Handling 
The fragility of pancakes - and better structures - (2006-06-26) 
Running external processes in Tcl and Tcl/Tk - (2006-06-29) 
Reading from another process in Tcl (pipes and sockets) - (2007-10-26) 
Buffering up in Tcl - the empty coke can comparison - (2007-11-10) 
stdout v stderr (Tcl, Perl, Shell) - (2007-12-10) 
Tcl - catching an error before your program crashes - (2009-10-22) 
Tcl - Some example of HOW TO in handling data files and formats - (2011-03-04) 
Reading the nth line from a file (Perl and Tcl examples) - (2011-06-09) 
The fileutil package and a list of file system commands in Tcl - (2012-02-18) 
Reading from a URL, and reading Json, from your Tcl script - (2015-03-12) 
Catching failed commands and not crashing the program in Tcl - (2015-10-10) 
Tcl - a new example for data reformatting - (2015-10-10)R106 - Input and Output in Ruby 
Some Ruby programming examples from our course - (2008-03-21) 
Ruby Programming Course - Saturday and Sunday - (2008-11-16) 
Opening and reading files - the ruby fundamentals - (2009-07-16) 
Neatly formatting results into a table - (2010-02-01) 
Ruby collections and strings - some new examples - (2010-02-03) 
Exclamation marks and question marks on ruby method names - (2010-07-28) 
Formatting your output - options available in Ruby - (2010-09-29) 
Significant work - beyond helloworld in Ruby - (2015-05-27) 
Expect with Ruby - a training example to get you started - (2016-05-18)P602 - Perl - Advanced File and Directory Handling 
Reporting on the 10 largest files or 10 top scores - (2006-08-20) 
Answering ALL the delegate's Perl questions - (2006-12-09) 
Perl - functions for directory handling - (2007-06-09) 
There is more that one way - Perl - (2008-07-14) 
Processing all files in a directory - Perl - (2008-10-11) 
Reactive (dynamic) formatting in Perl - (2008-10-31) 
Different perl examples - some corners I rarely explore - (2010-07-18) 
Handling binary data in Perl is easy! - (2011-08-30)
Some other Articles
Exceptions - a fail-safe way of trapping things that may go wrong3 digit HTTP status codes - what are they, which are most common, which should be a concern?Ruby at both extremes of your websiteSigils - the characters on the start of variable names in Perl, Ruby and FortranSearching through all the files in or below a directory - Ruby, Tcl, PerlHow many days to Christmas?What is on the Melksham Agenda?Automed web site testing scripted in Ruby using watir-webdriverOur National Autograss Champion, from MelkshamDivide 10000 by 17. Do you get 588.235294117647, 588.24 or 588? - Ruby and PHP
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).