Monday, January 12, 2009

Finding writable files in a directory in a windows command line

Simple thing, but if you want to find which files in a directory are writable, use this dos command ...


dir /a-r-d /s /b


/a is to search for attributes. In this case r is read only and d is directory. The minus signs negate those attributes. So we're looking for writable files only.

/s means recurse subdirectories

/b means bare format. Path and filename only.

6 comments:

Unknown said...

good post

Anonymous said...

very helpful

Asit Shukla said...

Although really simple but tremendously useful

Anonymous said...

Helpful. Thanks.

Anonymous said...

dir /a-r-d /s /b *.pas,*.dfm 1>writeable.txt ... This works for me to find files with specific extensions and dump them in a txt file for further parsing.

Anonymous said...

Brilliant - just what I was looking for.