Question

I have two computers that aren't networked. I need to replicate the folder structure of one drive that exists on one computer and put it on the other computer. Both Windows 7 machines. I don't need the files, just folders/directories. The drive letters are the same on both computers (Y). The computers are miles apart physically, but I do have access to the computer I am trying to get the folder structure of via LogMeIn.

I am thinking I need to save the folder structure to a file using some process. Move that file to my computer (via email or LogMeIn File Manager) and run some process to put in on my computer.

Is there a better solution? If not, is there code out there to do this via VBA, Cmd window, .bat script, VB.NET, or VBS? I know I can write it in VBA, but I'd rather not recreate the wheel if I don't have to.

I don't have a 'process'/program that does this. LogMeIn File Manager doesn't do this either (I asked). There are lots of paths on this drive that I need so creating them by hand would take a long time. I searched and found a lot of solutions that work with computers that are networked, but these computers are not networked, hence why I think I need to save it to a file. Again, I don't want all the files on the drive (its huge and most of the files are unnecessary), just folders.

thanks.

Was it helpful?

Solution

Create a directory listing of the source computer and redirect the output to a text file:

dir /ad /b /s >> dirlist.txt

The switches to dir are (more info at MS TechNet):

/ad     List only files with attribute of directory
/b      Bare format (no heading information or summary)
/s      Displays files in specified directory and all subdirectories

Transfer dirlist.txt from the source computer to the destination computer.

On the destination computer, use a for /F with that text file from the command prompt to create the directory structure:

for /F "delims=" %i in (dirlist.txt) do md "%i"

The switches to for are documented at MS TechNet

OTHER TIPS

You have many options:

  1. Windows command xcopy source destination /T /E. The /T option creates the directory structure, and the /E option includes empty directories.

  2. Bundle the empty directory structure into an installer (perhaps as a zip file).

  3. If the structure isn't relatively small and not likely to change, you could just put a bunch of md commands into a batch file.

  4. Combination - xcopy the structure locally, zip it, transfer it, unzip it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top