Index: trunk/Nebulous-Server/bin/nebdiskd
===================================================================
--- trunk/Nebulous-Server/bin/nebdiskd	(revision 28524)
+++ trunk/Nebulous-Server/bin/nebdiskd	(revision 28525)
@@ -53,5 +53,9 @@
 # set the process name for easy pgrep-ability
 $0 = 'nebdiskd';
-my $rcfile = "$ENV{HOME}/.nebdiskrc";
+#my $rcfile = "$ENV{HOME}/.nebdiskrc";
+my $rcfile = $ENV{NEBDISKDRC};
+unless (defined($rcfile)) {
+    $rcfile = '/etc/nebdiskd.rc';
+}
 $rcfile = File::Spec->canonpath($rcfile);
 
@@ -71,6 +75,4 @@
 my %host_removed = ();
 my $failure_limit = 5;
-
-
 
 #my $mounts = $c->get_mounts;
@@ -143,4 +145,6 @@
 $SIG{HUP}  = sub { $c = read_rcfile($rcfile) }; 
 
+my $date = localtime();
+$log->warn("BEGIN: $date with RCFILE: $rcfile");
 
 while (1) {
Index: trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 28524)
+++ trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 28525)
@@ -9,5 +9,5 @@
 no warnings qw( uninitialized );
 
-our $VERSION = '0.17';
+our $VERSION = '0.18';
 
 use base qw( Class::Accessor::Fast );
@@ -1508,4 +1508,106 @@
 
     return \@keys;
+}
+
+sub find_objects_wildcard
+{
+    my $self = shift;
+
+    my $log = $self->log;
+    $log->debug( "entered - @_" );
+
+    my ($pattern) = validate_pos( @_,
+        {
+            type        => SCALAR,
+            optional    => 1,
+        },
+    );
+
+    my $sql = $self->sql;
+    my $db  = $self->_db_for_index(0);
+    
+    # validate that we have a key to deal with
+    eval {
+        $pattern = parse_neb_key($pattern) if defined $pattern;
+    };
+    $log->logdie("$@") if $@;
+
+    unless (defined $pattern) {
+        $log->debug( "leaving" );
+        $log->logdie("no keys found");
+    }
+
+    # parse out the directory we're working in, and decide if we are a directory
+    my $dir_id = $self->_resolve_dir_parent_id(key => $pattern, dir_id => 1);
+    my $work_dir;
+    my $file_pattern;
+    if (defined $dir_id) {
+	$work_dir = $pattern;
+	$file_pattern = '%';
+    }
+    else {
+	my $dir_plain = dirname($pattern);
+	if ($dir_plain eq 'neb:') {
+	    $dir_plain = 'neb:///';
+	}
+	if ($dir_plain) {
+	    $work_dir = parse_neb_key($dir_plain);
+	}
+	else {
+	    $work_dir = parse_neb_key('/');
+	}
+	$log->warn("work dir: $work_dir " . $work_dir->path);
+	$file_pattern = basename $pattern;
+	unless ($file_pattern) {
+	    $file_pattern = '%';
+	}
+	
+	$dir_id = $self->_resolve_dir_parent_id(key => $work_dir, dir_id => 1);
+	unless (defined $dir_id) {
+	    $log->logdie("pattern $work_dir does not match any key or directory");
+	}
+    }
+    
+    # find dirs under dir
+    my @dir_keys;
+
+    eval {
+        $log->debug("looking for directories under dir: $dir_id");
+	$log->warn("dir_id: $dir_id pattern: $file_pattern");
+        my $query = $db->prepare_cached( $sql->find_dir_by_parent_id . " AND dirname LIKE ? ");
+        $query->execute( $dir_id, $file_pattern );
+
+        while ( my $row = $query->fetchrow_hashref ) {
+            next if $row->{'dir_id'} == 1;
+            my $dir = $row->{'dirname'};
+            if ($dir_id == 1) {
+                push @dir_keys, $dir . '/' if $dir;
+            } else {
+                push @dir_keys, $work_dir->path . '/' . $dir . '/' if $dir;
+            }
+            $log->debug( "matched $dir" ) if $dir;
+        }
+    };
+    $log->logdie("database error: $@") if $@;
+
+    # find files under dir
+    my @keys;
+    eval {
+        $log->debug("looking for objects under dir: $dir_id");
+        my $query = $db->prepare_cached( $sql->find_object_by_dir_id . " AND ext_id_basename LIKE ? ");
+        $query->execute( $dir_id , $file_pattern);
+
+        while ( my $row = $query->fetchrow_hashref ) {
+            my $key = $row->{ 'ext_id' };
+            push @keys, $key if $key;
+            $log->debug( "matched $key" ) if $key;
+        }
+    };
+    $log->logdie("database error: $@") if $@;
+
+    $log->debug( "leaving" );
+    
+    return [sort(@dir_keys), sort(@keys)];
+
 }
 
Index: trunk/Nebulous/bin/neb-ls
===================================================================
--- trunk/Nebulous/bin/neb-ls	(revision 28524)
+++ trunk/Nebulous/bin/neb-ls	(revision 28525)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
 
-# Copyright (C) 2007-2009  Joshua Hoblitt
+# Copyright (C) 2007-2009  Joshua Hoblitt, 2010 Chris Waters
 
 use strict;
@@ -16,18 +16,20 @@
 my (
     $server,
-    $long,
-#    $recursive,
+    $path,
+    $column,
 );
 
 $server = $ENV{'NEB_SERVER'} unless $server;
 
-# make --long the default
-$long = 1;
 
 GetOptions(
     'server|s=s'    => \$server,
-#    'recursive|r'   => \$recursive,
-    'l|1'           => \$long,
+    'path|p'        => \$path,
+    'column|c'      => \$column,
 ) || pod2usage( 2 );
+
+# twiddle column so that it does it by default.
+
+$column = not $column;
 
 my $pattern = shift;
@@ -47,19 +49,27 @@
 $pattern ||= "/";
 
-#if ($recursive) {
-#    $pattern = "^" . $pattern . ".*";
-#} else {
-#    $pattern = "^" . $pattern . "\$";
-#}
+my $keys = $neb->find_objects_wildcard($pattern);
 
-my $keys = $neb->find_objects($pattern);
-
+if ($path) {
+    my @files;
+    foreach my $key (@{ $keys }) {
+	my $uris = $neb->find_instances($key);
+	if (defined $uris) {
+	    push @files, URI->new(@$uris[0])->file;
+	}
+    }
+    @{ $keys } = @files;
+} 
 if ($keys) {
-    if ($long) {
-        print join("\n", @{ $keys }), "\n";
-    } else {
-        print join(" ", @{ $keys }), "\n";
+    if ($column) {
+	open(COLUMN,"|column") || die "Cannot open column command.";
+	print COLUMN join("\n", @{ $keys }), "\n";
+	close(COLUMN);
+    }
+    else {
+	print join("\n", @{ $keys }), "\n";
     }
 }
+
 
 __END__
@@ -73,11 +83,11 @@
 =head1 SYNOPSIS
 
-    neb-ls [--server <URL>] [-l|-1] [--recursive] <pattern>
+    neb-ls [--server <URL>] [-c] [-p] <pattern>
 
 =head1 DESCRIPTION
 
 This program list Nebulous keys matched by C<<pattern>>.  Call it with no
-arguments is equivalanet to searching with the pattern C<.*>.  Where
-C<<pattern>> is a POSIX 1003.2 compatable regular repression.
+arguments is equivalent to searching with the pattern C<neb://>.  SQL like
+wildcards are supported to select out certain files.
 
 =head1 OPTIONS
@@ -85,19 +95,14 @@
 =over 4
 
-=item * -l|-1
+=item * --path|-p
 
-Use a long listing format.
+Find the disk files corresponding to the keys found.
+
+=item * --column|-c
+
+Disable column formatting, and output results one to a line.
 
 Optional
 
-=cut
-#=item * --recursive|-r
-#
-#By default C<neb-ls> will only try to match the exact string provided to it.
-#With this option set all keys which match C<<pattern>> as a REGEX or substring
-#will be returned.
-#
-#Optional
-#
 =item * --server|-s <URL>
 
@@ -122,8 +127,4 @@
 =back
 
-=head1 CREDITS
-
-Just me, myself, and I.
-
 =head1 SUPPORT
 
@@ -132,9 +133,9 @@
 =head1 AUTHOR
 
-Joshua Hoblitt <jhoblitt@cpan.org>
+Joshua Hoblitt <jhoblitt@cpan.org>, Chris Waters
 
 =head1 COPYRIGHT
 
-Copyright (C) 2007-2009  Joshua Hoblitt.  All rights reserved.
+Copyright (C) 2007-2010  Joshua Hoblitt / Chris Waters.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under
Index: trunk/Nebulous/lib/Nebulous/Client.pm
===================================================================
--- trunk/Nebulous/lib/Nebulous/Client.pm	(revision 28524)
+++ trunk/Nebulous/lib/Nebulous/Client.pm	(revision 28525)
@@ -9,5 +9,5 @@
 no warnings qw( uninitialized );
 
-our $VERSION = '0.17';
+our $VERSION = '0.18';
 
 use Digest::MD5;
@@ -741,4 +741,46 @@
 }
 
+sub find_objects_wildcard
+{
+    my $self = shift;
+
+    my @args = validate_pos( @_,
+        {
+            type        => SCALAR,
+            optional    => 1,
+        },
+    );
+
+    $log->debug( "entered - @_" );
+
+    my $response = $self->{ 'server' }->find_objects_wildcard( @args );
+    if ( $response->fault ) {
+        $self->set_err($response->faultstring);
+
+        if ($response->faultstring =~ /no keys found/) {
+            $log->debug( "leaving" );
+            return;
+        }
+        if ($response->faultstring =~ /does not match any key or directory/) {
+            $log->debug( "leaving" );
+            return;
+        }
+
+        $log->logdie("unhandled fault - ", $self->err);
+    }
+
+    my $keys = $response->result;
+
+    $log->debug( "server found: @$keys" );
+
+#    foreach my $path ( @{ $uris } ) {
+#        $path = _get_file_path( $path );
+#    }
+
+    $log->debug( "leaving" );
+
+    return $keys;
+}
+
 
 sub find_instances
