November 23rd, 2004

Why do folders like “My Pictures” come back after I delete them?

Some people are offended by the special folders like “My Pictures” and “My Music” and delete them, only to find them being re-created. What’s going on?

Windows itself is okay with you deleting those folders. Some corporations, for example, remove those folders from their employees’ machines because they don’t want the employees looking at pictures and listening to music while on the job. (Go figure.) And if the folder is deleted, Windows doesn’t try to bring it back.

However, any program can ask for the folder to be re-created. For example, if a program passes the CSIDL_FLAG_CREATE to the SHGetFolderPath function, then Windows will create the specified folder if it doesn’t exist. Similarly if it passes pass fCreate = TRUE to the SHGetSpecialFolderPath function.

If it really troubles you, you can set a creation audit on the My Pictures folder and see which program is re-creating it.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.