Which command recursively searches the file system for a specific file, listing full path?

Study for the SANS560 GIAC Penetration Tester (GPEN) Test. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

Which command recursively searches the file system for a specific file, listing full path?

Explanation:
To locate a file by name anywhere on a Windows system, you want a command that traverses directories and prints the exact paths of any matches. The dir command with the recursive switch and bare format does exactly that: it searches through all subdirectories (/s) and prints only the paths to matching files (/b), giving you the full path for each hit. By specifying the starting directory and the file name pattern, this command walks the directory tree and lists every instance of the file with its full path, making it ideal for finding where a file resides. Other options don’t match this goal: using a database-based locator relies on an index that may be out of date; searching within files for a string with a text-search tool isn’t about finding a file by name; and the dir-based approach is the straightforward method to reveal full paths of file-name matches across the filesystem.

To locate a file by name anywhere on a Windows system, you want a command that traverses directories and prints the exact paths of any matches. The dir command with the recursive switch and bare format does exactly that: it searches through all subdirectories (/s) and prints only the paths to matching files (/b), giving you the full path for each hit. By specifying the starting directory and the file name pattern, this command walks the directory tree and lists every instance of the file with its full path, making it ideal for finding where a file resides.

Other options don’t match this goal: using a database-based locator relies on an index that may be out of date; searching within files for a string with a text-search tool isn’t about finding a file by name; and the dir-based approach is the straightforward method to reveal full paths of file-name matches across the filesystem.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy