get the current directory based on dirformat