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
    |   list.txt
    |   script.bat
    |   script.txt
        |   file-2nd-1.txt
        |   file-2nd-2.txt
        |   file-2nd-3.txt
        |       file-3rd-1.txt
        |       file-3rd-2.txt
        |       file-3rd-3.txt
        |   |   file-3rd-4.txt
        |   |   file-3rd-5.txt
        |   |   file-3rd-6.txt
        |   |   
        |   \---3rd_Level-1
        |           file-4th-1.txt
        |           file-4th-2.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:

Windows / Create txt files of subfolders with file names in it

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:


Doesn't make sub directories.

  • This sounds terribly suspiciously like malware. What are you trying?
    – pulsejet
    Sep 18, 2016 at 19:06
  • robocopy has been included with windows since XP iirc, so something based on robocopy /create would probably be simplest
    – Eris
    Sep 18, 2016 at 19:11
  • @RadialApps; that's in the question: 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 can't use the master directory, but I don't want to waste time downloading things I already have / dealing with file conflicts when moving things from usb to master.
    – anonymouse
    Sep 18, 2016 at 19:11
  • It's clear you didn't read my comment, from technet docs on robocopy: /create : Creates a directory tree and zero-length files only.
    – Eris
    Sep 18, 2016 at 19:30
  • @eris Found info on robocopy, but it's clear as mud: ROBOCOPY Top_Lvl Shadow /CREATE only results in 3 files in the newly created Shadow directory.
    – anonymouse
    Sep 18, 2016 at 19:44

1 Answer 1


@eris had the right idea.

From the commandline:

robocoy *Top_Lvl* *Shadow* /create /mir

Looks like it creates a shadow directory structure with zero-length files that mirrors the master directory. All that remains is to figure out how to do this on a drive, which should be simple matter of figuring out paths for the source and destination. It does however, need to be used with caution as it doesn't automatically throw up an error before over-writing files and directories (sub-optimal, imho).

It doesn't do the additional work of being able to make files which also provide information (size of the original file), but it's a good-enough solution for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.