Is there a clever way to group a bunch of files together besides using a folder (for Windows desktop background images)?
I have many photographs, and I want to pick about 1000 of them to use as Windows desktop backgrounds (aka wallpapers).
The easiest thing to do is copy the ones I want into their own folder, and then tell Windows to use that folder for desktop backgrounds.
But that involves wasting storage and also making sure I don't accidentally move any files instead of just copying them (and then having to remember in a few years that I copied them, and didn't move them).
Is there a more clever way to approach this?
I tried creating a folder filled with shortcuts to a few of the images I wanted, but Windows did not recognize the shortcuts for using their corresponding images as desktop backgrounds.
You can create hard links using the mklink command to link the specific image files you want to display in the same folder rather than shortcuts or [symbolic] soft links (e.g. lnk
files).
Once you create the hard link, the actual file content consuming the disk space will not be purged unless both the link and the original file are deleted. If one or the other are deleted, the file stays until both are deleted.
Essentially this creates another file that merely points to the same location on the disk the actual content resides so two files will share that same pointer essentially and not be duplicated.
Batch [cmd] Commands
cd /d "D:\Images\WallPaper"
mklink /H "Cool.jpg" "D:\Photos\2019\Jan\Cool.jpg"
mklink /H "Lightning.jpg" "D:\Photos\2009\Dec\Lightning.jpg"
Important: Be sure to cd /d
to the folder which you will point the wallpaper slideshow to view, and you'll need to be sure the hard links and files are located on the same drive partition.
Note: There are two parameter values to specify after the mklink /H
. The first value is the name of the file\link only, and the second is the full path to the orginal file you want to link it to.
Powershell Commands
You can also create hard links with PowerShell so below are a couple examples of those commands.
New-Item -ItemType HardLink -Path "D:\WallPaper\cool.jpg" -Target "D:\Photos\2019\Jan\Cool.jpg"
New-Item -ItemType HardLink -Path "D:\WallPaper\Lightning.jpg" -Target D:\Photos\2009\Dec\Lightning.jpg"
Supporting Resources
- MKLink
mklink /?
Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Link Specifies the new symbolic link name. Target Specifies the path (relative or absolute) that the new link refers to.
-
New-Item
-
Hard link
-
Understanding NTFS Hard Links, Junctions and Symbolic Links
A hard link is a file that represents another file on the same volume without actually duplicating the data of that file. More than one hard link can be created to point at the same file. Hard links cannot link to a file that is on a different partition, volume or drive. Hard links on directories are not supported as it would lead to inconsistencies in parent directory entries.