Tree?

Jul. 8th, 2009 06:45 pm
swestrup: (Default)
[personal profile] swestrup
The Linux 'tree' command conveniently outputs a display tree of files and associated data. That's just what I want, only I want to be able to provide my own (potentially very large) list of files. Anyone know how to do that? Tree only seems to accept file names on the command line, and I'll quickly blow through that.

Date: 2009-07-08 10:56 pm (UTC)
From: [identity profile] sps.livejournal.com
It seems like a job for sort and sed, or possibly a small perl script?

cat <names> | sort | xargs ls -d<flags> | <something that replaces repeated prefixes of the form \/.*\/ with leaders at the start of the line>

Date: 2009-07-09 12:08 am (UTC)
From: [identity profile] joenotcharles.livejournal.com
Editing the source to take arguments from stdin should be trivial. Are you sure "cat > tree -" doesn't do anything?

Date: 2009-07-09 12:47 am (UTC)
From: [identity profile] sps.livejournal.com
Except that it almost certainly drives the indentation state from the recursive directory traversal. Said he without checking.

January 2017

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 14th, 2026 04:15 am
Powered by Dreamwidth Studios