[vox-tech] HTML coding conundrum

Harold Lee harold at hotelling.net
Sun Jul 31 12:24:45 PDT 2011


You can generate links to a bunch of files using "find":

cd /path/to/parent_directory
find directory_name -type f \( -name '*.jpg' -o -name '*.jpeg' -o -name
'*.gif' \) | while read filename ; do echo "<a
href=\"$filename\">$filename</a>"; done

The "-o" means OR, so you can add more file extensions in the find command.

You can put this output into your HTML if you just want to generate a bunch
of links. Or you can use the find command this way to bulk post pictures to
some online gallery (e.g. a Drupal or Wordpress site) using curl or wget
instead of echo.

Harold

On Fri, Jul 29, 2011 at 6:46 PM, Darth Borehd <darth.borehd at gmail.com>wrote:

> I have a lot of club media files (pictures, videos, and sound) on a drive
> running Ubuntu 10.04 LTS.  I want to share these media files on the
> Internet.  I figure the best way is to make a webpage with links that
> correspond to the files, so clicking on a link downloads the file or plays
> it in browser.
>
> The problem is there are thousands of these little files.  I tried manually
> creating links by copying and pasting, but it's taking me to long.
>
> I tried webmagick, but I found it only works on picture files.  Otherwise,
> it looks to be exactly what I want.
>
> Any suggestions?
>
> _______________________________________________
> vox-tech mailing list
> vox-tech at lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.lugod.org/pipermail/vox-tech/attachments/20110731/879c744c/attachment.htm 


More information about the vox-tech mailing list