Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: list of files with full path

> I looked at the manual about "modifiers" -
> and they all seem to cut off something.
> now, what to use to make a listing of files
> with a full path?  is there a modifier for that?
> $ ls **/*(???)
> /dir/file
> /dir/subdir1/file1
> /dir/subdir1/file2
> /dir/subdir2/file1
> /dir/subdir2/file2
> etc
> There *must* be something for
> that with the ZShell, right?  ;-)

This works for me:

% print -l **/*

or, if you need to use ls, at least the -d option to show directories
rather than their contents:

% ls -d -1 **/*

If you want to prefix the current working directory, try this:

% print -l $PWD/**/*
% ls -d -1 $PWD/**/*

zsh doesn't strip paths from filenames unless you use one of the "word
modifiers" like ":t" ("tail"):

% print -l $PWD/**/*(:t)
(this won't be meaningful with ls)

If you want to print only files, and omit the directory names that
contain them (as your example above does, by leaving off /dir and
/dir/subdir{1,2}), the modifier is (.) for normal files only:

% ls -d -1 **/*(.)
% print -l **/*
% ls -d -1 $PWD/**/*(.)
% print -l $PWD/**/*(.)

I think the latter two produce the output you are seeking, based on your

Or have I misunderstood the question?

Debbie Pickett http://www.csse.monash.edu.au/~debbiep debbiep@xxxxxxxxxxxxxxxxxx
"Where's the man, where's the child? Wrapped together side by side, who can tell
   you what to do when Mr Time has come for you?" - _Mr Time_, Alan Parsons

Messages sorted by: Reverse Date, Date, Thread, Author