Smith and Andersen
asked on
Script to create subfolders
I need to create a script that I can run on a file share that will create a specific subfolder in the same location for all folders. vbscript...batch...powersh ell all are good
Currently the share is setup like below
h:\
h:\year folder (folders are 1965, 1966,1967... up to 2013
h:\year\Building(building folders are named with last 2 year digits then 3 digits sequentially...65001,65002 ,97001,971 35, 12001,12005 and so on).
We have literally thousands of building folders, I need to be able to create a folder called DST off the root of all building folders
Thanks in advance for all help!
Currently the share is setup like below
h:\
h:\year folder (folders are 1965, 1966,1967... up to 2013
h:\year\Building(building folders are named with last 2 year digits then 3 digits sequentially...65001,65002
We have literally thousands of building folders, I need to be able to create a folder called DST off the root of all building folders
Thanks in advance for all help!
in powershell
#this should get all directories with the name Building
get-childitem h:\ -recurse | ? {($_.name -like "Building*") -and ($_.attributes -eq "directory")} | % {
$outpath = $_.fullname + '\DST'
md $outpath
}
#this should get all directories with the name Building
get-childitem h:\ -recurse | ? {($_.name -like "Building*") -and ($_.attributes -eq "directory")} | % {
$outpath = $_.fullname + '\DST'
md $outpath
}
ASKER
Hi guys
my issue is I dont have any folders called building. As I mentioned in my post...the building folders are named like 65008, 72154, 99001 so the file path would be
h:\2013\13001
Have a look at the png
I need a dst folder off the root in every subfolder under each year
H-drive.PNG
my issue is I dont have any folders called building. As I mentioned in my post...the building folders are named like 65008, 72154, 99001 so the file path would be
h:\2013\13001
Have a look at the png
I need a dst folder off the root in every subfolder under each year
H-drive.PNG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
cant believe how efficient that was...
Open in new window
And if you insist on a script, you only need to double up on the percent signs And we can make it look a bit more elegant:Open in new window