How to delete a hidden file in DOS

Found myself in a peculiar situation today morning. Last night just before going to bed, my Windows laptop had crashed which made gvim leave a hidden swap file.

I opened a command prompt window and wanted to get rid of the file after having rescued the contents. But that’s where I got stuck ! The del or erase DOS commands would not work with the /f flag – no luck with brute force.

The solution is actually a bit interestingly convoluted. You have to specify the /a flag to say that you want to select based on some attribute and then put h as the specifier for hidden files.

image

I had to search for quite some time before I could figure out this. Maybe I am slow, but thought would quickly blog this should some other wayfarer lose her way.

Why did I not chose the Windows Explorer interface ? Programmer’s ego.

Advertisements

One thought on “How to delete a hidden file in DOS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s