How's this for a round about way...
ZIP up the file (7-zip, actually)
then unzip it (again, 7-zip)
- Code: Select all
7-zip.exe a filename.7z filename.ext
7-zip.exe x filename.7z -o*
That will first zip up the filename.ext into filename.7z.
Then it will extract the file from filename.7z into a (sub)directory named filename.
So if you have a file named, test.jpg:
- Code: Select all
7-zip.exe a test.7z test.jpg
7-zip.exe x test.7z -o*
You end up with, a (sub)directory named, /test/ which contains the file, test.jpg.
(The original file, test.jpg also remains.
You need not actually compress the file, simply storing it in the archive container (.7z) is fine & faster.
Depending on needs, you could automate this with a batch file, iterating through the list of files in a directory, creating the .7z's, then extracting the same into individually same named directories...
Iteration, would need to be done on a per file basis.
Extraction, directory creation, can be done en-mass, using an eXtract command like; 7-zip.exe x %* -o*)