[macvoiceover] Re: Folders

  • From: Greg Kearney <gkearney@xxxxxxxxx>
  • To: macvoiceover <macvoiceover@xxxxxxxxxxxxx>
  • Date: Sat, 28 Jul 2007 13:54:50 -0600

OK that will take a bit more. Are these NL books digital or tape recording, just currious


Greg
On Jul 28, 2007, at 13:41 , Richard Most wrote:

Greg

ls -lR foldername | grep "^d" | wc -l will do the same thing.

What I want to do is set focus on a folder and run a program that will tell me the number of folders in the target folder. What I do not want to do is go into terminal to run the program. I can just open the folder and do VO keys + shift + end to get the count. This is more keystrokes than I want to do. Why I want the folder count is to check on a jaws script that I have running on one of my XP computers. This jaws script is used to automate the ripping and resampling of NLS talking books.
On Jul 28, 2007, at 11:40 AM, Greg Kearney wrote:

Here's a perl program that will do that. it will even speak the number of directories and the number of files. take the code below and save it to a file. make the file executable in the terminal like this: chmod 775 /path/to/perlcount.pl then run it like this: / path/to/perlcount.pl /path/to/directory

This whole thing could be done from the command line like this: ls - tl /path/to/directory | grep -c '^d'

The code below just makes this all nice and tidy with error checking.

Below is the perl code itself along with some comments, line preceded by #:



#!/usr/bin/perl
#

$testdir = $ARGV[0]; # put the first argument into the $testdir varriable this is the path to your directory.
#let's make sure the path given is a directory and not a file.
if (-d $testdir) {
#It's a directory so let's count the number of ls entries that start with d and put that number in to $dircount.
        $dircount = `ls -tl $testdir | grep -c '^d'`;
        #display the number.
        print "Number of directories: $dircount\n";
        #speak the number.
        `say "Number of directories:$dircount."`;
} else {
        #the path didn't exist or was a file so we tell the user.
        print "Please use a path to a directory.\n";
        `say "Please use a path to a directory."`;
}       
#----END OF CODE----

On Jul 27, 2007, at 13:49 , Richard Most wrote:

Howdy all,
Is there a way to find out the number of folders in a folder without opening the target folder?
Thanks for any help.

Richard Most
louie@xxxxxxxxxxxxxxxxx





Click on the link below to go to our homepage.
http://www.icanworkthisthing.com

Manage your subscription by using the web interface on the link below.
//www.freelists.org/list/macvoiceover

Users can subscribe to this list by sending email to  
macvoiceover-request@xxxxxxxxxxxxx
with 'subscribe' in the Subject field OR by logging into the Webinterface at //www.freelists.org/list/macvoiceover



Richard Most
louie@xxxxxxxxxxxxxxxxx




Click on the link below to go to our homepage.
http://www.icanworkthisthing.com

Manage your subscription by using the web interface on the link below.
//www.freelists.org/list/macvoiceover

Users can subscribe to this list by sending email to  
macvoiceover-request@xxxxxxxxxxxxx
with 'subscribe' in the Subject field OR by logging into the Webinterface at //www.freelists.org/list/macvoiceover



Click on the link below to go to our homepage.
http://www.icanworkthisthing.com

Manage your subscription by using the web interface on the link below.
//www.freelists.org/list/macvoiceover

Users can subscribe to this list by sending email to macvoiceover-request@xxxxxxxxxxxxx with 'subscribe' in the Subject field OR by logging into the Web interface at //www.freelists.org/list/macvoiceover

Other related posts: