Declan Grady wrote:
> I have a list of folder full of pdf files, of which I regularly create a
> html list of name, date and size. - after a bit of fiddling, this awk
> command seems to work
>> ls -l | awk '{print "<a
> href=\"http://www.nuvotem.com/en/products/pdf/"$9"\">"$9"</a>","<br>Date:
> "$7"-"$6"-"$8,"<br>Size: "$5" bytes \n\n\n<br><br>"}'
>>>>/home/declan/pdflist.html
>>>>> This gives me an output like so : (full list at
>http://www.nuvotem.com/pdflist.html )
>> <a href="http://www.nuvotem.com/en/products/pdf/AC1005.pdf">AC1005.pdf</a>
> <br>Date: 11-Jan-14:10 <br>Size: 55595 bytes <br><br>
> <a href="http://www.nuvotem.com/en/products/pdf/AC1010.pdf">AC1010.pdf</a>
> <br>Date: 11-Jan-14:10 <br>Size: 52907 bytes <br><br>
> .... etc etc
>> 3 questions:
> 1. How can I get the date format to show 11-Jan-2002 instead of 11-Jan-14:10
> ?
> 2. How can I *easily* get the "description" from the pdf "document info"
> from each pdf file ?
> 3. How *should* I have gone about achieving this, considering I'm no
> programmer ?
My daily find command. In general if you need inode info, use find, not
ls (whose output is really only for parsing by humans)
find -type f -maxdepth 1 -printf "<a href=\"http://www.nuvotem.com/en/products/pdf/%P\">%P</a><br>Date: %Td-%Tb-%Ty<br>Size: %s bytes\n"
> Thanks,
> Declan
> [NODIS]
Padraig.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!