-1

Directory Junctions allow a folder to be redirected to another location.

  • so you could create a directory junction as: C:\Users\Ian\Downloads\Torrents
  • and have it resolve to: S:\Torrents

This would appear in a directory listing as:

 Directory of C:\Users\Ian\Downloads

10/03/2020 01∶19 ᴘᴍ <JUNCTION> Torrents [S:\Torrents]

You can make a directory junction with the command:

C:\Users\Ian\Downloads>mklink /J Torrents S:\Torrents

Windows also uses this feature to help support buggy applications that don't follow the rules. You can see this if you get a directory listing of your profile folder:

 Directory of C:\Users\Ian

10/03/2020 01∶19 ᴘᴍ <JUNCTION> Application Data [C:\Users\Ian\AppData\Roaming] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> Cookies [C:\Users\Ian\AppData\Local\Microsoft\Windows\INetCookies] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> Local Settings [C:\Users\Ian\AppData\Local] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> My Documents [C:\Users\Ian\Documents] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> NetHood [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Network Shortcuts] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> PrintHood [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Printer Shortcuts] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> Recent [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Recent] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> SendTo [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\SendTo] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> Start Menu [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Start Menu] 10/03/2020 01∶19 ᴘᴍ <JUNCTION> Templates [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Templates]

All those folders were the default locations in Windows 2000, but were moved in later versions of Windows. Windows continues to create those folders as junctions because of the disgusting number of applications that assume those are valid locations of anything.

C:\Users\Ian
|-- Application Data → [C:\Users\Ian\AppData\Roaming]
|-- Cookies → [C:\Users\Ian\AppData\Local\Microsoft\Windows\INetCookies]
|-- Local Settings → [C:\Users\Ian\AppData\Local]
|-- My Documents → [C:\Users\Ian\Documents]
|-- NetHood → [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Network Shortcuts]
|-- PrintHood → [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Printer Shortcuts]
|-- Recent → [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Recent]
|-- SendTo → [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\SendTo]
|-- Start Menu → [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Start Menu]
|-- Templates → [C:\Users\Ian\AppData\Roaming\Microsoft\Windows\Templates]

Second generation of lousy programs

For 26 years now, since Windows 95, applications are supposed to store their application data in CSIDL_APPDATA:

SHGetFolder(CSIDL_APPDATA)D:\Users\AppData\Roaming

There is a plague of new applications that are also not following the rules. They are dumping their garbage in the user's home folder, rather than the application data folder. For example:

Ian
|-- .borland
|-- .cache
|-- .config
|-- .dotnet
|-- .gitconfig
|-- .idlerc
|-- .lemminx
|-- .MakeMKV
|-- .MCTranscodingSDK
|-- .nuget
|-- .omnisharp
|-- .pylint.d
|-- .QtWebEngineProcess
|-- .redhat
|-- .SimulationCraft
|-- .ssh
|-- .vscode

This is all completely, and totally wrong. Not only does it violate the Windows programming contract, not only does it dump stuff in the wrong folder, not only does it clutter up my home folder with things that are not mine, but it consumes drive space when i explicitly told these apps to store their data elsewhere (in the appdata folder on the bigger drive).

Now, i have no hope of these application developers fixing their buggy applications; they're obviously Linux or Javascript programmers, who don't know how to write real applications. And if they haven't been able to figure it out after 26 years: they're not gonna now.

Obviously what i can do is move the contents of all these folders to their correct home in CSIDL_AppData, and then create the junction (or symbolic link) for each of them:

Ian
|-- .borland &rarr; [D:\Users\Ian\AppData\Roaming\.borland]
|-- .cache &rarr; [D:\Users\Ian\AppData\Roaming\.cache]
|-- .config &rarr; [D:\Users\Ian\AppData\Roaming\.config]
|-- .dotnet &rarr; [D:\Users\Ian\AppData\Roaming\.dotnet]
|-- .gitconfig &rarr; [D:\Users\Ian\AppData\Roaming\.gitconfig]
|-- .idlerc &rarr; [D:\Users\Ian\AppData\Roaming\.idlerc]
|-- .lemminx &rarr; [D:\Users\Ian\AppData\Roaming\.lemminx]
|-- .MakeMKV &rarr; [D:\Users\Ian\AppData\Roaming\.MakeMKV]
|-- .MCTranscodingSDK &rarr; [D:\Users\Ian\AppData\Roaming\.MCTranscodingSDK]
|-- .nuget &rarr; [D:\Users\Ian\AppData\Roaming\.nuget]
|-- .omnisharp &rarr; [D:\Users\Ian\AppData\Roaming\.omnisharp]
|-- .pylint.d &rarr; [D:\Users\Ian\AppData\Roaming\.pylint]
|-- .QtWebEngineProcess &rarr; [D:\Users\Ian\AppData\Roaming\.QtWebEngineProcess]
|-- .redhat &rarr; [D:\Users\Ian\AppData\Roaming\.redhat]
|-- .SimulationCraft &rarr; [D:\Users\Ian\AppData\Roaming\.SimulationCraft]
|-- .ssh &rarr; [D:\Users\Ian\AppData\Roaming\.ssh]
|-- .vscode &rarr; [D:\Users\Ian\AppData\Roaming\.vscode]

But i'd have to do that manually for every existing folder. But then i would miss every new piece of crap-ware that dumps its garbage on the sidewalk.

What would be great is if directory junctions (or even symbolic links) supported a wildcard:

mklink /J C:\Users\Ian\.* D:\Users\Ian\AppData\Roaming\.*

I know mklink doesn't do that; but:

  • it doesn't hurt to ask
  • maybe someone has another idea

Bonus Reading

Bonus Chatter

Along the same lines, there is the disgusting number of applications that dump their junk into My Documents folder:

D:\Users\Ian\Documents
|-- .AccessibilityInsights
|-- .Adobe
|-- .Adobe Scripts
|-- .AdobeStockPhotos
|-- .Aerofly FS 2
|-- .AeroFS
|-- .Axialis Librarian
|-- .BabeLua
|-- .Battlefield 3
|-- .Black & White 2
|-- .Blackbird_data
|-- .Borland Studio Projects
|-- .Colossal Order
|-- .com.nolimitscoaster.nolimits2
|-- .CommView
|-- .Curse
|-- .Dash
|-- .Diablo III
|-- .Dungeon Siege
|-- .Dungeon Siege LOA
|-- .EA Games
|-- .Embarcadero
|-- .Fiddler2
|-- .FlashIntegro
|-- .Flight Simulator X Files
|-- .Heroes of the Storm
|-- .Hitman Blood Money
|-- .Host Integration Projects
|-- .IISExpress
|-- .inblock
|-- .MessageAnalyzer
|-- .My Curse
|-- .My Data Sources
|-- .My Games
|-- .My Virtual Machines
|-- .My Web Sites
|-- .MyFlash
|-- .Oculus Home
|-- .Pascal Analyzer
|-- .Prepar3D Files
|-- .Project CARS
|-- .Rec Room
|-- .Reflector
|-- .Remote Assistance Logs
|-- .RESTDebugger
|-- .SimCity
|-- ....
|-- .zion

If you see your app in this list: please fix it. My Documents folder is for My documents - not your application data.

Ian Boyd
  • 23,066

1 Answers1

0

No you can't do wildcards. Make a link to a folder containing the files.. a directory junction or symbolic link. It can't do * because each junction needs to point to a specific parse point of a real item.. good luck.

Andy
  • 11