generate file list?
am 08.10.2007 23:00:18 von Auric__
I need to generate a list of all files in the current directory and
all subdirs, but not the directories themselves. I need each entry to
have either the full path or the full path relative to the current
dir. (This is simple in DOS: "dir/a-d/b/s".)
Either of these examples is acceptable:
------
foo
bar/1
bar/2
baz/3
baz/4/5
--or--
/home/me/foo
/home/me/bar/1
/home/me/bar/2
/home/me/baz/3
/home/me/baz/4/5
------
....but this is not:
------
foo
bar:
1
2
baz:
3
4:
5
------
I thought I could just do it with ls but I'm having a hell of a time
figuring out which switches would be appropriate. (Of course, it
doesn't *have* to be ls.)
There's got to be a simple solution to this, but I've been beating my
brains out over it all weekend. (Okay, not really, but it *is*
annoying.) Help? Please? (If it matters, it's Linux kernel 2.4.35 on
a Pentium III.)
--
auric dot auric at gmail dot com
*****
- I really need to figure out how to use a debugger in emacs.
- Pfft, how could you *not* know?
- It's just ctrl+alt+meta+f7+numlock+c+e+m+<
- Hell, you could discover that by accident in emacs.
--
Posted via a free Usenet account from http://www.teranews.com
Re: generate file list?
am 08.10.2007 23:59:57 von cfajohnson
On 2007-10-08, Auric__ wrote:
>
>
> I need to generate a list of all files in the current directory and
> all subdirs, but not the directories themselves. I need each entry to
> have either the full path or the full path relative to the current
> dir. (This is simple in DOS: "dir/a-d/b/s".)
find . -type f
find "`pwd`" -type f
--
Chris F.A. Johnson, author
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
Re: generate file list?
am 09.10.2007 00:03:27 von Auric__
On Mon, 08 Oct 2007 21:59:57 GMT, Chris F.A. Johnson wrote:
> On 2007-10-08, Auric__ wrote:
>>
>> I need to generate a list of all files in the current directory
>> and all subdirs, but not the directories themselves. I need each
>> entry to have either the full path or the full path relative to
>> the current dir. (This is simple in DOS: "dir/a-d/b/s".)
>
> find . -type f
>
> find "`pwd`" -type f
I'm gonna go jump off a bridge now.
--
auric dot auric at gmail dot com
*****
The phrase "delusions of grandeur" comes to mind.
--
Posted via a free Usenet account from http://www.teranews.com
Re: generate file list?
am 09.10.2007 00:33:37 von Auric__
On Mon, 08 Oct 2007 22:03:27 GMT, Auric__ wrote:
> On Mon, 08 Oct 2007 21:59:57 GMT, Chris F.A. Johnson wrote:
>
>> On 2007-10-08, Auric__ wrote:
>>>
>>> I need to generate a list of all files in the current directory
>>> and all subdirs, but not the directories themselves. I need each
>>> entry to have either the full path or the full path relative to
>>> the current dir. (This is simple in DOS: "dir/a-d/b/s".)
>>
>> find . -type f
>>
>> find "`pwd`" -type f
>
> I'm gonna go jump off a bridge now.
P.S. Thank you.
--
auric dot auric at gmail dot com
*****
It's not even my moral code and it's biting me in the ass.
--
Posted via a free Usenet account from http://www.teranews.com
Re: generate file list?
am 09.10.2007 01:37:46 von Stephane CHAZELAS
2007-10-8, 17:59(-04), Chris F.A. Johnson:
> On 2007-10-08, Auric__ wrote:
>>
>>
>> I need to generate a list of all files in the current directory and
>> all subdirs, but not the directories themselves. I need each entry to
>> have either the full path or the full path relative to the current
>> dir. (This is simple in DOS: "dir/a-d/b/s".)
>
> find . -type f
>
> find "`pwd`" -type f
In POSIX shells, you can also do:
find "$PWD" -type f
Which, contrary to "`pwd`" works even if the current directory
name ends in a newline character.
I generally prefer
find "$PWD" -type f -print
Which is more legible and works better with some old versions of
find.
--
Stéphane
Re: generate file list?
am 09.10.2007 17:28:58 von Auric__
On Mon, 08 Oct 2007 23:37:46 GMT, Stephane CHAZELAS wrote:
> 2007-10-8, 17:59(-04), Chris F.A. Johnson:
>> On 2007-10-08, Auric__ wrote:
>>>
>>>
>>> I need to generate a list of all files in the current directory
>>> and all subdirs, but not the directories themselves. I need each
>>> entry to have either the full path or the full path relative to
>>> the current dir. (This is simple in DOS: "dir/a-d/b/s".)
>>
>> find . -type f
>>
>> find "`pwd`" -type f
>
> In POSIX shells, you can also do:
>
> find "$PWD" -type f
>
> Which, contrary to "`pwd`" works even if the current directory
> name ends in a newline character.
Thanks for that, but since all the dirs I'll be using this is were
created in Windows, that's not really a concern. (Although... I'll
probably use $PWD if it's more portable than `pwd` .)
> I generally prefer
>
> find "$PWD" -type f -print
>
> Which is more legible and works better with some old versions of
> find.
Thanks for that, too.
--
auric dot auric at gmail dot com
*****
"Eureka" is Greek for "this bath is too hot".
--
Posted via a free Usenet account from http://www.teranews.com
Re: generate file list?
am 09.10.2007 18:54:50 von Spiros Bousbouras
On Oct 8, 10:59 pm, "Chris F.A. Johnson" wrote:
> On 2007-10-08, Auric__ wrote:
>
> > I need to generate a list of all files in the current directory and
> > all subdirs, but not the directories themselves. I need each entry to
> > have either the full path or the full path relative to the current
> > dir. (This is simple in DOS: "dir/a-d/b/s".)
>
> find . -type f
>
> find "`pwd`" -type f
Shouldn't it be
find . ! -type d
Re: generate file list?
am 09.10.2007 18:54:55 von Stephane CHAZELAS
2007-10-09, 15:28(+00), Auric__:
[...]
>>> find "`pwd`" -type f
>>
>> In POSIX shells, you can also do:
>>
>> find "$PWD" -type f
>>
>> Which, contrary to "`pwd`" works even if the current directory
>> name ends in a newline character.
>
> Thanks for that, but since all the dirs I'll be using this is were
> created in Windows, that's not really a concern. (Although... I'll
> probably use $PWD if it's more portable than `pwd` .)
[...]
It's not more portable, it would even tend to be less portable
(some very old shells like the Bourne shell don't support it),
it's just slightly more reliable and is more efficient.
--
Stéphane
Re: generate file list?
am 09.10.2007 19:24:57 von Loki Harfagr
On Tue, 09 Oct 2007 16:54:50 +0000, Spiros Bousbouras wrote:
> On Oct 8, 10:59 pm, "Chris F.A. Johnson" wrote:
>> On 2007-10-08, Auric__ wrote:
>>
>> > I need to generate a list of all files in the current directory and
>> > all subdirs, but not the directories themselves. I need each entry to
>> > have either the full path or the full path relative to the current
>> > dir. (This is simple in DOS: "dir/a-d/b/s".)
>>
>> find . -type f
>>
>> find "`pwd`" -type f
>
> Shouldn't it be
> find . ! -type d
This is a semantics question, did the OP mean strictly 'files' or
did he mean 'not the directories' (as he also typed), I'll suppose
the former but only the OP knows the rhyme ;-)
Re: generate file list?
am 10.10.2007 18:56:24 von djandymiles
Hello Auric_
as I see, you've' already found your answer...
I wanted to ask you if the email in your signature is still valid or
if you look in it anyway.
Cause I've send an email to this address. No, not about a question or
something like this. Just an opinion.
Maybe you can look and tell me if you have received it.
Greets,
Andreas E. Mueller
Re: generate file list?
am 11.10.2007 01:02:16 von Auric__
On Tue, 09 Oct 2007 17:24:57 GMT, loki harfagr wrote:
> On Tue, 09 Oct 2007 16:54:50 +0000, Spiros Bousbouras wrote:
>
>> On Oct 8, 10:59 pm, "Chris F.A. Johnson"
>> wrote:
>>> On 2007-10-08, Auric__ wrote:
>>>
>>> > I need to generate a list of all files in the current
>>> > directory and all subdirs, but not the directories themselves.
>>> > I need each entry to have either the full path or the full
>>> > path relative to the current dir. (This is simple in DOS:
>>> > "dir/a-d/b/s".)
>>>
>>> find . -type f
>>>
>>> find "`pwd`" -type f
>>
>> Shouldn't it be
>> find . ! -type d
>
> This is a semantics question, did the OP mean strictly 'files' or
> did he mean 'not the directories' (as he also typed), I'll suppose
> the former but only the OP knows the rhyme ;-)
I was thinking "regular files"; I wasn't thinking of devices,
symlinks, etc. (This'll probably be running on a FAT32 FS so most of
those kinds of things won't be a worry.)
--
auric dot auric at gmail dot com
*****
That's really kind of gross, y'know.
--
Posted via a free Usenet account from http://www.teranews.com
Re: generate file list?
am 11.10.2007 01:06:34 von Auric__
On Wed, 10 Oct 2007 16:56:24 GMT, Andreas E. Mueller wrote:
> Hello Auric_
>
> as I see, you've' already found your answer...
>
> I wanted to ask you if the email in your signature is still valid
> or if you look in it anyway.
> Cause I've send an email to this address. No, not about a question
> or something like this. Just an opinion.
>
> Maybe you can look and tell me if you have received it.
Yes, it's current, but I only check that address once a week or so.
Sometimes not even that often.
I'll post a response to your email in *that* group. Gimme a few
minutes.
--
auric dot auric at gmail dot com
*****
People need to realize when a romantic partner declares they're
undeserving, it's not flattery, it's a warning shot.
--
Posted via a free Usenet account from http://www.teranews.com