Added option to specify directory rather than files