Skip to content

prasannarajaram/Powershell-Scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Powershell-Scripts

Handy scripts that make life easier

Create directory structure based on an existing directory

Create directory structure based on an existing directory

There is sometimes a need to exactly replicate an existing folder (only with directory structure and not its files) structure.
Usually we end up creating a new folder (target-directory), and then, create a new sub-directory (in the same name as the source directory) by copy-paste method.
This approach works if the number of sub-directories are a few. If they number of sub-directories are more, then a tool can come in handy. The following powershell script can be used to create (duplicate) a directory structure without creating internal files (or sub-sub-directories)

 Get-ChildItem -Directory "your\source\directory\path\here\" | ForEach-Object {
    $target = "your\destination\directory\path\here\" + $_.Name
    New-Item -ItemType Directory -Path $target -Force
}

Here is a short video

create-directory-structure_tCuOrh98.mp4

About

Handy scripts that make life easier

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published