[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ls and globbing and full pathnames



On Tue, Jan 23, 2007 at 12:45:33AM +0100, Robert MannI wrote:
> Hello Linux Masters!
> 
> I have a particular problem I need to solve related to the "ls" command 
> and
> globbing.
> 
> As an example, to see the all of the files in the root directories of my
> websites I do:
> $ ls -m /var/www/*
> 
> This gives me the output in the form:
> ---
> /var/www/site1:
> index.html, some_image.jpg
> 
> /var/www/site2:
> index.html, some_other_file
> ---
> 
> Which is beautiful, but I need to work with the output, hence I need the
> full filepaths, something like this:
> ---
> /var/www/site1/index.html, /var/www/site1/some_image.jpg,
> /var/www/site2/index.html, /var/www/site2/some_other_file
> ---
> Is there any known way to get that kind of output instead?

find /var/www

then you get the full joy of using find's many features too. just
remember if you are using globbing in find's arguments (such as -name
or -iname) that you should escape the wildcards ala \*

if you really want a comma seperated list, the check out sed or cut.

hth

A

Attachment: signature.asc
Description: Digital signature


Reply to: