powershell - Create Directory with ls and Create-Item -


i wanted create in directory same folders of directory (which contains 234 folders).

my ideas was

ls -name | new-item -itemtype directory -path d:\test\ 

i multiple times error d:\test path exsits.

this doesn't work, directory creation part new-item -itemtype never uses value pipeline.

what's more, don't filter output ls, non-directory files processed too.

# list of folders gci | ? { $_.psiscontainer } | % {    # create dir. uses join-path , $_.name combine new root dir directory's name   new-item -itemtype directory -path $(join-path "d:\myroot" $_.name) } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -