| Jeff Abrahamson on 13 Jun 2006 14:21:56 -0000 |
|
On Tue, Jun 13, 2006 at 09:01:26AM -0400, Art Alexion wrote:
> [24 lines, 138 words, 883 characters] Top characters:_ etnioas
>
> On Monday 12 June 2006 13:25, Jeff Abrahamson wrote:
> > I know this is now solved, but there's a simple solution that wasn't
> > mentioned:
> >
> > find . -type d | perl -pwe 's|[^/]+/| |g'
> >
> > Remove the "-type d" to get all files instead of just directories.
> > Note the obvious extension to print id3 tags by having a function as
> > the second element in the pipe, so that it prints the indent, the
> > name, and then the id3 tag if there is one.
>
> Jeff, is there a function you had in mind?
Assuming you have a program called, say, "id3" that spits out what you
want, define a shell function like this:
name-id3() { name=$1; tag=$(id3 $name); \
base=$(echo $name | perl -pwe 's|[^/]+/| |g'); \
echo $base " " $tag; }
and then
find . -print -exec name-id3 \{\} \;
Disclaimer: I haven't tested this, it may contain syntax errors. You
might have to put the function into a script to have it executed
properly from find.
OK, maybe this wasn't obvious...
--
Jeff
Jeff Abrahamson <http://jeff.purple.com/> +1 215/837-2287
GPG fingerprint: 1A1A BA95 D082 A558 A276 63C6 16BF 8C4C 0D1D AE4B
Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|