[Techtalk] backup - tar
John Clarke
johnc+linuxchix at kirriwa.net
Thu Sep 2 10:57:56 EST 2004
On Wed, Sep 01, 2004 at 05:42:24 -0700, Maria McKinley wrote:
> Maybe there is a way to write a script that would list all directories
> that first letter is a-m and output it to a file, same for n-z. That
> would get around the human error element of dividing home in half.
That's easy:
[johnc at dropbear ~]$ ls -1d /home/[a-m]*
/home/alexz
/home/caseya
/home/eloff
/home/gabea
/home/gregk
/home/jamest
/home/jimb
/home/johnc
/home/lost+found
/home/markg
-1 means print one file/directory per line; -d means list directory
names instead of their contents.
If you want directories only, try:
[johnc at dropbear ~]$ find /home/ -type d -maxdepth 1 -name '[a-m]*'
/home/lost+found
/home/johnc
/home/markg
/home/jamest
/home/gregk
/home/caseya
/home/gabea
/home/eloff
/home/jimb
/home/alexz
find doesn't sort names (pipe the output to sort if you want sorted
names). ls sorts by default (add -U if you want unsorted names).
Cheers,
John
--
Ah, yes.. spammers.. and a Sun with their default sendmail config? No,
thank you. Been there, done that, got the free coupons, CDroms, lists of
email-addresses, viagra-pills, MLM-opportunities, and yes, even the T-shirt.
-- Paul Boven
More information about the Techtalk
mailing list