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

Re: Bash globbing files only?

Yep, that would work, but I guess my question was a bit poorly
formulated. I am writing a bash script that has:


and I'd like to have "files=..." without using find or other external
commands if at all possible.


Actually that last one wasn't ideal.  A better solution would be
ls -lAR / | grep "^-"
This would give you files, not symbolic links, not directories, not
block devices, not character devices.

I can't find any way to do it with ls alone.

Of course the best way is with the find command, being

find / -type f

which will not only give you the file names, but with their complete
path.  If you want the files listed in long format, then use

find / -type f -ls

By the way the syntax you have to list directories does not work for
me.  It yields the same results as if I did ls *, which lists all
files in the current directory, and files in directories contained in
the current directory (in lieu of listing the directory name).

Any reason why you'd rather use ls instead of find?



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