I was quite impressed with myself the other day that I’d actually managed to write a bash script within ubuntu which served a purpose. I wanted to be able to monitor the size of files within a particular directory, and report back their size when a change was observed.I found a program called fileschanged, which fulfilled half the problem, namely reporting back a file had changed, but I needed a greater level of detail than that. What it did allow me to do however was pass the filename as an argument (along with some other parameter) to another program. I duely spent an hour or so trying to figure out a script to take that filename and report back its filesize and the current time (which I assume is close enough to that which the file was changed). This is what it looks like:#!/bin/bashif [ -z "$1" ] && [ -z "$2" ]; then exitfiFN=$2DATE=$(date +%s)FILESIZE=$(stat -c%s "$FN")echo "$DATE,$FN,$FILESIZE"
Twitter: niftydigits- Just watched "King of Kong" and weirdly noted it has the same director as the film I watched last night, "Horrible Bosses". How bizarre.. 11:58:47 AM February 04, 2012 from TweetDeck
- @JamFactory will give that a look. Thanks for the heads up. 08:29:14 PM February 03, 2012 from TweetDeckin reply to JamFactory
- You know that kid that turns up to the swimming pool and splashes everyone else? That's my kid. 04:50:59 PM February 03, 2012 from TweetDeck
- Why Yellow Pages stock is down. RT @ianibbo: hehe http://t.co/sjy0vkFN 03:32:53 PM February 03, 2012 from TweetDeck
- This is great. RT @foomandoonian Siri in Scotland: http://t.co/ujX0IA9N - See also: http://t.co/SgqcIDHL 09:41:09 PM February 02, 2012 from TweetDeck
- Injected With A Poison by Praga Khan is my latest Jam. http://t.co/jiGBwmFM #thisismyjam 07:27:00 PM February 02, 2012 from TweetDeck
- @alistairholt yeah. Not much point in making a saas app here if you're an indie. 01:51:44 PM February 02, 2012 from TweetDeckin reply to alistairholt
- @alistairholt no 11:40:12 AM February 02, 2012 from TweetDeckin reply to alistairholt
- @foomandoonian Ooh. Sounds exciting. You going to be writing one? 11:03:31 AM February 02, 2012 from TweetDeckin reply to foomandoonian
Tags
amazon associates aws blogging boards book review competition cotton couchdb customer service decryption design development domains expressjs fairtrade fashion filezilla hacking hosting hotdealsuk internet JavaScript jobs jQuery lovefilm marine parade microsoft Music naconf node nodejs PHP principles shopping standards tees t shirts tshirts unicycling Web web design web services wishlist wordpressCategories