NavigationUser loginSpam?See spam posts on this site? If so, please don't reply to the spam! Instead, just report the URL to the webmaster. |
Finding all files, including "hidden"I want to list all the subdirectories of /tmp, including those starting with a dot, so I have come up with the following command: find \ Thet's the best I've managed, but it's very long-winded. Surely there's an easier way to do it? Thanks. (1 vote) |
Maybe...
If I execute the command you posted I get exactly the same results as if I just execute
find /tmp/ -type d
Ok, except that /tmp itself is not included in the list created by your command.
BTW,
"I want to list all the subdirectories of /tmp, including those starting with a dot"
That's exactly what find does. No need for any special fiddling.
Cheers, Georg
Maybe...
OK, thanks, but how can I exclude /tmp without resorting to the -prune stuff? I need it exact because I will be piping the list to another program. Maybe I'm just stuck with what I have.
Tony.
$world=~s/war/peace/g;
Not that simple then...
Hi Tony
find /tmp -type d | sed 1d
The 'sed' stuff deletes the first line (and the start directory /tmp always comes first).
This would do it too:
find /tmp/ -type d -and -not -path /tmp/
Well, don't know if that's any simpler than the find command you posted. I guess that's just a matter of taste whichever you prefer. The last one is almost human readable though ;-).
Cheers, Georg
Not that simple then...
That's certainly simpler, thanks.
However, I've since rewritten the script in Perl, so the problem doesn't apply any more. Perl's File::Find module works very well.
Tony.
$world=~s/war/peace/g;