{% for page in site.pages
%}{% assign url = page.url | slice: 1, 100
%}{% assign last_char = page.url | slice: -1
%}{% if url contains "/" and last_char != "/" %}{% assign subpage = true %}{% else %}{% assign subpage = false %}{% endif
%}{% unless subpage == true or url == "" or url == "feed.xml"
%}
* [{{ page.title }}]({{ page.url | relativeurl }}) {% endunless
%}{% endfor %}
Wednesday, June 14, 2017
Jekyll Pages List
Getting a list of pages in a Jekyll site is easy, but paring that down to just the top-level files and the index pages is tricky.
Wednesday, May 24, 2017
File timestamp reset
I had a bunch of old MS Word docs that I wanted to convert to PDFs. I did it in LibreOffice, but the new PDFs were all new - I wanted them to have the same timestamps as the Word docs.
Also, just opening the Word docs in LibreOffice updated their modification times. So what I wanted to do was get the original creation time for each Word doc, and use that to set the creation and modification times for both the Word doc and its corresponding PDF file.
This does that:
IFS= ; for x in *.doc ; do y=${x%.doc}.pdf ; d=`stat -c %W $x` ; touch -d @$d $x $y ; done
The character after IFS=
is a tab, which you can insert by typing ctrl-v TAB
.
Subscribe to:
Posts (Atom)