Modified to operate on current directory if no directory is specified