I think I would like to regenerate a directory of text/fake files in a USB stick with the exact names of files that exist in a master directory.
The master directory is on a terabyte drive, and it's much to big to fit on any usb stick. But, when I'm using the usb stick, I'd like to collide filenames when I'm downloading a duplicate from other places. ie: I try and download something and it'll say, "You already have a file named..."
I don't mind running this (as long as it's relatively fast) script manually, when I update the master directory with new additional files, and moving the resulting file structure of fake files by hand onto the usb stick.
I have at least 3 levels of directory structure. I've put together a simple test directory structure with txt files, vs the (mostly) pdf real structure. When I output
tree /a /f . > list.txt,:
Folder PATH listing for volume Windows Volume serial number is 00C7-D795 C:\USERS\USER\DESKTOP\TEST | list.txt | script.bat | script.txt | \---Top_Lvl | file-2nd-1.txt | file-2nd-2.txt | file-2nd-3.txt | +---2nd_Level-1 | file-3rd-1.txt | file-3rd-2.txt | file-3rd-3.txt | +---2nd_Level-2 | | file-3rd-4.txt | | file-3rd-5.txt | | file-3rd-6.txt | | | \---3rd_Level-1 | file-4th-1.txt | file-4th-2.txt | \---2nd_Level-3 file-3rd-7.txt
I don't know how to write a header so a pdf reader would display a file with a .pdf extension (but that is actually a text file) - which would be a really awesome bonus. And I can't find a command (attrib does not work, as far as I can tell) that will output the size of the file into the text output. As it would be cool to have the size of the actual file available by clicking on the fake file, without having to look anything up somewhere else.
Potential partial solutions?
I found this:
But it appears to make a mess, and only does one level of directories.
And when I re-wrote it/modified it, it worked once, and then quit working:
@echo off for /dd %%D in (*) do ( cd %%~nxD tree /a /f > ..\%%~nxD.txt cd .. echo %%~nxD > dir_info.tmp for /f "skip=3 delims=*" %%a in (%%~nxD.txt) do ( echo.%%a >> dir_info.tmp ) copy /y dir_info.tmp %%~nxD.pdf del /f /q dir_info.tmp )
It would dump the results within the directory it is run in, instead of dropping it to the desktop (and I can't figure out how to drop it to a default desktop - vs. hard-coding it, if I use more than one computer/account to access the master directory drive). And I'm not sure you can specify the usb stick, as that probably changes all the time, depending on what else is plugged in.
Also, I'm very often on old windows systems, which is why I was looking into a batch file. If there's an app which does this, I'd definitely consider it - instead of re-carving the wheel.
@eris has suggested Robocopy and there's something called RichCopy:
But those applications would make actual duplicates of the master directory - and I don't have that much spare storage space, in either the master drive (and, as stated priorly: in the working usb stick).
It appears that I wasn't clear enough; I'm trying to make a shadow directory, that has all the filenames (and optimally information on the real file, like size) including extensions - but in minimal space; I'm guessing it'll be a megabyte or 3 in actual space consumption (as every file and directory uses ~block) vs. 100s of gigs (eg: 50mb file, 1mb file, 832k file, 10mb file, 15mb file).
It looks like robocopy is what I want, if I can get the commandline working correctly:
ROBOCOPY Top_Lvl Shadow /CREATE
Doesn't make sub directories.