recreating folder structure

I needed to recreate a folder structure from one computer to another.
To be ahead of some comments I foresee, one computer did not have powershell or any internet connection (to download powershell), and I was not allowed to install anything.

To solve the problem I used “old school” DOS commands.

  • Open a command prompt
  • navigate to the correct folder
  • execute the command: “dir /s /b /ad > createfolders.bat”
  • edit the just created createfolders.bat file with an advanced text editor which supports macro’s (like download notepad++ )
  • Make a macro that put’s the command “md” (make directory) on every single line, and removes the part in front of the line you don’t need (like d:\ or so)
  • Copy and execute this batch file onto your computer on which you want to recreate the folder structure

Simpel.. ain’t it.

2 thoughts on “recreating folder structure

  1. Here’s the PowerShell way:

    Copy-Item -Path . -filter {$_.PSIsContainer} -Destination \\server\share -Recurse -Force

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>