[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Determination of file lists from selected folders without returning
From: |
SF Markus Elfring |
Subject: |
Re: Determination of file lists from selected folders without returning directory names |
Date: |
Mon, 17 Jul 2017 21:37:41 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
>> A corresponding result could be achieved by using a subshell (which I would
>> like to avoid for this use case) for a command like “(cd ${my_dir} && ls
>> *txt)”.
>
> If you want to capture these strings into a variable, you can't really
> avoid a sub-process.
I looked at a programming interface like the function “opendir”.
I imagine that there are more advanced possibilities to improve the software
run time characteristics for this use case.
> For instance simply doing:
>
> names=$(echo *txt)
>
> involves a sub-process for the command substitution. Since it is echo,
> it could be optimized.
I hope so.
> I just checked though; …
Thanks for your interest.
> If the goal is to just dump the names on standard output without the
> directory prefix,
Something like that.
> it can be done like this:
>
> for name in dir/*txt ; do
> echo ${name#dir/}
> done
I would like to avoid such an operation “Remove matching prefix pattern”
generally.
If the desired file lists contain only basenames, extra prefixes do not need
to be deleted.
Regards,
Markus
Re: Determination of file lists from selected folders without returning directory names, Kaz Kylheku (Coreutils), 2017/07/17
- Re: Determination of file lists from selected folders without returning directory names,
SF Markus Elfring <=
- Re: Determination of file lists from selected folders without returning directory names, Kaz Kylheku (Coreutils), 2017/07/17
- Re: Determination of file lists from selected folders without returning directory names, Eric Blake, 2017/07/17
- Re: Determination of file lists from selected folders without returning directory names, SF Markus Elfring, 2017/07/18
- Re: Determination of file lists from selected folders without returning directory names, Kaz Kylheku (Coreutils), 2017/07/18
- Re: Determination of file lists from selected folders without returning directory names, SF Markus Elfring, 2017/07/18
- Re: Determination of file lists from selected folders without returning directory names, Bernhard Voelker, 2017/07/18
- Re: Determination of file lists from selected folders without returning directory names, SF Markus Elfring, 2017/07/18
- Re: Determination of file lists from selected folders without returning directory names, Bernhard Voelker, 2017/07/18
- Re: Determination of file lists from selected folders without returning directory names, SF Markus Elfring, 2017/07/19
- Re: Determination of file lists from selected folders without returning directory names, Eric Blake, 2017/07/19