created getDirCommand which finds array of current working directories