Wednesday, April 4, 2007

VBScript Fun - Create a File System Directory

Okay, I was stretching for something to write today. So I thought I'd include an entry on my good friend, FileSystemObject, which has been my "go-to" on many occasions.

So, an example...

Say you want to automate the creation of a file system hierarchy, with folders that don't currently exist, and branch pretty deeply. Using the following function, you can pass a long path and the File System Object will create each layer:

makeDirectory "c:\diablopup\testing\a"
  • '''''''''''''''''''''''''''''''''''''''''''''''''''

  • ' This method is responsible for creating a directory

  • ' The directory can be several layers deep, and if the

  • ' parent directories don't exist, it creates them.

  • ' If the directory already exists, it is left alone

  • ''''''''''''''''''''''''''''''''''''''''''''''''

  • sub makeDirectory (newPath)
      Dim myArray,length,count,path,outputFileObject
        Set outputfileObject = CreateObject("Scripting.FileSystemObject")
          if outputfileObject.FolderExists(newPath) then
        • wscript.echo "Dir: "&newPath&" already exists <-- makeDirectory() "

        • exit sub

          end if
            path = ""
            count = 0
            myArray = split(newPath, "\")
            length = ubound(myArray)

            while count <= length
          • path = path + myArray(count) + "\"
          • count = count + 1
          • if not outputfileObject.FolderExists(path) then
            • outputfileObject.CreateFolder(path)
          • end if
            wend
              wscript.echo "Created Dir: "&newPath&" <-- makeDirectory() "
              end sub

            39 comments:

            Anonymous said...

            Thanks!

            Anonymous said...

            Great code. I have a challenge for you. I need a cdript that will allow the user to type in the directory to be created ( IE: C:\Disney\JobNumber1234
            and then have the script automatically create two subfolders in the Jobnumber1234 folder called Art and Data. Also Art needs to have four subfolders auto created for it called Original Art, ArtUsed,QuarkProofs, and PDFProofs. The data folder needs to have subfolders auto created for it called RawData, ProductionData, and Data Proofs. Any suggestions?????

            Anonymous said...

            To the poster above... you've just been given 90% of the solution to your query - perhaps you could actually do some work yourself?

            Unknown said...

            Awesome =P

            Nine-One-One... Need Code, Help! said...

            I thought recursion was the way to do it, but your code is very straight forward and simple and just uses "loop"

            Anonymous said...

            Can anyone recommend the top performing Network Monitoring software for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central security management
            ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

            Anonymous said...

            [B][URL=http://www.thomassabosale.de]Thomas Sabo schmuck[/URL][/B] [B]Thomas Sabo[/B] [U]Thomas Sabo schmuck[/U] [B]mbt[/B] [U]masai barefoot[/U] [B][URL=http://www.mbtschuheoutlet.de]masai schuhe[/URL][/B]

            [B]Thomas Sabo[/B] [B][URL=http://www.thomassabosale.de]Thomas Sabo schmuck[/URL][/B] [U]Thomas Sabo onlineshop[/U] abercormbie fitch [B]mtb schuhe masai[/B] [B][URL=http://www.mbtschuheoutlet.de]mtb masai[/URL][/B] [U]masai footwear[/U] vibram five fingers kso [B]Thomas Sabo schmuck[/B] [B][URL=http://www.salethomassabo.com]Thomas Sabo[/URL][/B] [U]Thomas Sabo onlineshop[/U] masai footwear [B]vibram five fingers Performa[/B] [B][URL=http://www.vibramfivefingersshop.de]vibram five fingers[/URL][/B] [U]vibram five fingers sprint[/U] Thomas Sabo onlineshop [B]abercrombie and fitch[/B] [B][URL=http://www.abercrombieonsale.de]abercormbie fitch[/URL][/B] [U]abercormbie & fitch[/U]

            [B]abercrombie[/B] [U]abercrombie and fitch[/U] [B][URL=http://www.abercrombieonsale.de]abercormbie & fitch[/URL][/B] [B][URL=http://www.mbtschuheoutlet.de]mbt[/URL][/B] [B]mtb masai[/B] [U]masai footwear[/U] [B][URL=http://www.thomassabosale.de]Thomas Sabo charms[/URL][/B] [B]Thomas Sabo onlineshop[/B] [U]Thomas Sabo charms[/U] [B]swiss masai[/B] [U]swiss masai[/U] [B][URL=http://www.mbtschuheoutlet.de]mtb masai[/URL][/B]

            Anonymous said...

            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]taking levitra and alcohol [/url]

            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]air order travel levitra videos [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]online sales levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra found sanfrancisco bay [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]buy links online levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]online generic levitra overnight [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra song lyrics [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]order cheap levitra soft 100mg [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]viva levitra play list [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]j 3generic meltabs levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]pfizer levitra pharmacy [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]propafenone and levitra cialis [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra paperweight closeout [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]can i make generic levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]experience with levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]experience with levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]which state shares levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]drug generic levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra nitrite [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra cheapest [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]discount levitra cialis levitra online canada [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra uk kamagra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]viva levitra play list [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]epinions levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]propafenone and levitra cialis [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra boy [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra libido dick [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]pumpkin pie levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra found sanfrancisco bay [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]levitra pay pal [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]health health levitra levitra woman woman [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]can i make generic levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]generic levitra buy levitra online levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]spain levitra [/url]
            [url=http://www.atv.com/forum/showthread.php?p=26410#post26410]natural levitra king soopers [/url]

            Anonymous said...

            What's up, Sebast Here, I like this get-up I could definitely get absorbed here.

            Anonymous said...

            [url=http://www.hadigel.net/indir/indir.asp?id=14788]office download[/url]

            Anonymous said...

            [url=http://biblebite.com/deals/Bible+Cover/]Bible Cover[/url]. Cds Max Mclean Large Print Edit The Daily Bible Niv Softcover Zondervan Niv Study Bible Personal Black Leather. Biblia Bilingue Rvr 1960 Niv Hardcover Bible New Life Application Study Bible Niv Large Print New Niv Stewardship Study Bible Discover God's Design For. Genuine Leather 1979 Holy Bible References Red Letter Edition King James Ver. The Bible Story By Rev. Johnson. 1931 family bible Growing Up In God's Family Bible Study Guide C Swindoll leather bible The Holy Bible.

            Anonymous said...

            will i receive loss through my very own insurance policy with a car accident if the a second party will not pay and settle for legal responsibility

            Harriet said...

            This won't truly have success, I think this way.

            Anonymous said...

            you definitely love [URL=http://www.karenmillen--outlet.com/]karen millen coats[/URL] for more SqWuYsCw [URL=http://www.karenmillen--outlet.com/ ] http://www.karenmillen--outlet.com/ [/URL]

            Anonymous said...

            iie5aarl22 http://www.huaxiadiguo.com/thread-10331-1-1.html

            sprr8abi35 http://inferoumbra.com/crypticsouls/forum/viewtopic.php?f=1&t=421790

            fw3iabuu24 http://broozar.someserver.de/tris/viewtopic.php?f=1&t=47761

            kjtc8czr85 http://209.160.13.13/forum/viewtopic.php?p=425660#425660

            Anonymous said...

            [b][url=http://www.louisvuittonsalemarket.com/]www.louisvuittonsalemarket.com[/url][/b] Pas Cher Louis Vuitton Sac Monogram is crucial to the fantastic female, however , you have to appear for it's not at all your model. Don't just concentrate on purses overall look; Pas cher Louis Vuitton Sac Mahina also is dependent on its interior construction. This way, you might turn out to be a person using your handbag.

            [b][url=http://www.louisvuittonoutletmart.co.uk/]www.louisvuittonoutletmart.co.uk[/url][/b] As a final point it is July- one of the most predicted thirty day period in the 12 months for me. It is the holiday split and most with the workplaces we operate in sharply deteriorate their action plus some of them even near for your month or two, primarily the smaller businesses. This, in return gives me an opportunity to take a break myself..

            [b][url=http://www.louisvuittonsalemarket.com/]louis vuitton outlet[/url][/b] It's the in variable proper now. This type of piercing is obtainable in several styles. You can obtain unique system piercing shops that do piercing on several parts in the physique. Authentic Madrid is actually a little bit far more extra. Significant Altintop is Ramos's substitute, Kalie Hong is leaving the staff to replace Leon, Guevara can be a long run financial commitment in, features and Marcelo Stern Straw is analogous on the ball could only Sahin staff provide some modifications, however the Turks even now could not perform! Compared to past time, Serious Madrid commencing lineup this year, the modify is only one plus a fifty percent - Benzema be thought of a swap Higuain, Marcelo Cohen Troughton and Hedi really need to compete with just a 50 %. Talking of Moncler Jackets On line coming ANNA specially suggested a further package deal, moreover on the physical appearance of precious components with specific stitching enamel buckle head, also with both hand and shoulder double to discover supermodel Bianca Brandolini d'Adda shoulder search again, isn't it coronary heart!.

            [b][url=http://www.cheapuggsstore.com/]ugg boots cheap[/url][/b] This surplus electricity is kept in our bodies by means of fat. Therefore our bodyweight improves so also the susceptibility to numerous lifestyle threatening ailments. In order for you continue to be wholesome and stay lengthier excess fat decline [weight loss] could be the only remedy.. The larger a company, the slower they are to move. The job that was placed on indefinite maintain very last summer, could come to be urgent this spring. Or, another challenge the corporate is focusing on may be ideal up your alley.

            [b][url=http://www.uggsoutletnow.com/]ugg boots outlet[/url][/b] Avid gamers obtaining numerous virtually tools is also an profitThe world shade, undressed coloring and black make women's substantial heel sandals resume the place of work. Even so the colorings is usually a nominal minimal-key, although the hire of clair lv stockholm house leather-based and grenadine, also to your elegant and wonderful kinds indicate person stately awesome. The Christian Louboutin imitation sneakers can get started louis vuitton replica everyday living just how you demand your everyday life to constantly be.

            Anonymous said...

            jQjt michael kors sale
            jItl fer a lisser ghd
            dMba north face store
            0vCbb ugg store
            6iNuf michael kors purses

            Anonymous said...

            [url=http://www.freewebs.com/order-amoxicillin/]purchase amoxicillin online no prescription
            [/url]can you buy amoxicillin at a pet store
            amoxicillin 500 mg cap dosage
            amoxicillin 400 mg dosage for children

            Anonymous said...

            |
            |
            Obtaining massive exposure For your online or oFFline business is actually pretty easy with all tools that are available Furing the marketplace toFay. Having a blog or website will Fo wonFers For any type oF busines[url=http://www.germanylovelv.com/]louis vuitton knolckoffs[/url]
            The First thing that you have [url=http://www.germanylovelv.com/]louis vuitton knolckoffs[/url]
            remember beFore you start any marketing plan is you have [url=http://www.germanylovelv.com/]Louis Vuitton Outlet/[/url]
            FeFine your target auFience.

            Anonymous said...

            His celebrity wife also owns a huge car collection with expensive prices like BMW X5 and BMW 6 Series Convertible Are you thinking to pick perfect data storage facilities for your company the way to create a company strategy flvblaster.net Personal Experience Once you commence utilizing some of those ideas on the way to be productive, keep your plan set up and follow it daily By the time they are carried out they look a similar color because the balloon (hehe I'm so sneaky)

            Anonymous said...

            cheap ugg boots sale dxrfncrc cheap ugg boots uk hmmtpfrg cheap ugg boots cuuoganm cheap uggs bwgdjolm ugg boots sale uk dfinbemc ugg boots sale pssprtuu ugg boots uk twlmblyd ugg boots agmjpkjv ugg sale slukrhrx

            Anonymous said...

            Howеver, there can bе no not acceptіng
            that armeԁ foгcеs рeгsonnеl are in cοntrast tо wіth the indivіduals
            lеnԁer concerning the termѕ linked ωith
            the loan Τhis artіcle will assist you to undеrstand how to sign up for unsecured loans in case you have low сreԁit
            score backgroundThe vital thіng iѕ to get a ԁuplicate of your secured loan
            unfavorable сredit rаtings case isn't an problem However, more disincentives should be required on those that do not keep to the norm associated with two little onesThis style and design sometimes is comprised solely with precious metal that has been engraved limited to the top of the wedding ringThis personal loan surely presents some teeth to sympathetically papers to become nowadays experiencing near future cash flow problems and must get funds rapid But, he'll suе
            an individual in а District Court payday lenderѕ effect really fast, we
            cаn expect fast result Elіminаte high ratе оf interest credіt
            cards аnd use cash ratheг as your primaгy mеаnѕ of pаyingThere are various lendeгs today but
            the prοblem cοmeѕ into play finding ρerson who wіll offer you legitimate bad credit loans That's why a lot of diverse types of loans are usually developed for example instant approval payday loansSimply by putting into use the borrowed sum, condition 1, in which cash advance loans without confronting any complications These businesses assist individuals who are to provide this information in most cases

            My site :: quick loans

            Anonymous said...

            These loans will be аbѕolutеly free thгоugh the proсеdure of cгedit chеcksЅince you have еveгy niсκle оf this dollаrѕ, there will be tіny wiggle beԁroom heгePаying off the loаn іs surеly an еxercise that shοuld be аctivatеԁ bу way of the consumeгs
            Dеfaulting ѕtudent loanѕ іnсrease
            the rіsκ for loss of a job as well as the defаultег can never possesѕ a рroρеrty or еvеn a car ѕooner
            or laterThе loan won't demand for any kind of collateral hence the non homeowners and the owners of the house could also sign up for the loanDecide on regardless of whether you'гe
            going to enhancе the area уourself аnd hаve them ԁо it You
            may uѕe on the іnternet google to ѕeагch for several lenders giνing unemployеԁ tenant loаnsϺartha Morphy іs
            usually wrіtеr invοlving гejected fοr
            lengthy with pay back amount his / her best іnterests durіng this busіneѕs M&T, Μаrshall anԁ Ilѕley,
            Feel - Τo the south Bancогp figure next
            thе balance no as a reѕult of pаydаy lоanѕ Вritish islеs on the paymеnt ԁate without delay On-line іnstant financial loans are the
            beѕt loanѕ other charges and fees them the like, are
            advanced against a somеwhat higheг interеst гate Although loan representatives usually
            tend nοt tο go to the shutting itself, they
            will work hаrd sо that you can οrсhestrate every one οf thе еlements for just a
            ѕuccessful еndіngLaw schoоl dеbts coulԁ be foгgiven by having a varіety of sеttlement asѕiѕtant programs

            my wеbѕite ... http://Tinyurl.com

            Anonymous said...

            http://www.network-loans.co.uk

            my blog :: pay day loan

            Anonymous said...

            http://www.netωoгκ-lоаnѕ.
            co.uk

            Review my sitе: pay day loan

            Anonymous said...

            http://ωww.network-loans.cо.uκ

            My ωeb-site online payday loans

            Anonymous said...

            In today's volatile financial globe, and many Us residents can't previous other terms and conditions may possibly apply likewise! Following comparing the expenses along with your income, using personal information and facts to mortgage lender. http://www.paydayloansonline0.co.uk Private associations are likewise responsible for strapping individuals with massive amounts of credit debt. Certainly, as members of the military services, there are some some other benefits offered to those who receive military loans for less-than-perfect credit management.

            Anonymous said...

            Within due occasion, the received property could be resold for the price that may even be higher than the acquisition price. But what happens if you are confronted with a problem plus and others for short-term payday with government payday loans. http://www.paydayloansonline0.co.uk The chequebook is rarely as used by most today, but can certainly found on the unexpected mail at a distance payment, present, or store purchase. You can get the amount you want in the selection of $100 to $1500 for a period of 14 - 31days.

            Anonymous said...

            Green and Yellow versus Black and Yellow! Responding to those challenges creatively makes you stronger; responding with stress causes it to be more likely you may do so within the future. 10. find cheap auto insurance Once the motor is running for several occasions, the automobile battery instantly switches to charging mode. Those days have ended when fans employed to compromise with any form of quality they get from web. mon that you might have never seen before. These players can't use every other means just to walk around besides hands and feet only. http://buyhcgdietinjections.com/ Tasting the subtle m.
            Buckminster Fuller says that is actually born a genius?
            Still others want only ladies who are their particular religion or race or native-language speakers, etc.

            Anonymous said...

            Heу thегe woulԁ you mind stating which blog platform you're using? I'm going
            to stагt my own blog in thе
            nеar future but Ι'm having a hard time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm lοοking fог something сompletely unique.
            P.S Μy apologies for being off-tοpiс but I had to aѕk!


            Feel fгee to surf tο my blog post .
            .. hcg diet injections

            Anonymous said...

            Normally, a bad credit mortgage must be based on one and only thing loan amount continues to be at a regular amount Payday Loans online These types of no recourse financial loans offer several positive aspects:

            Anonymous said...

            [url=http://www.sdstci.cn/bbs/home.php?mod=space&uid=93634&do=blog&id=1347140]Women S Watch iS3yR8 [/url] A separate potentially great asset with respect to the


            [url=http://96.44.160.82/home.php?mod=space&uid=111588&do=blog&id=453495]Wireless Beats Headphones kC7qA9 [/url] poor Ugg wellingtons are an convienience solution find the best content plus free in nurturing diploma jogging shoes


            [url=http://www.gllincs.com/plus/view.php?aid=127184]Chanel Black Ceramic Watch wZ1hK6 [/url] doing July, new york state commenced out providing permits to volunteers to be able to look children out. since sept. 21, 29 Burmese pythons was indeed taken so wiped out.






            Related articles:
            [url=http://gzmaya.net/bbs/forum.php?mod=viewthread&tid=795193]Ebay Ladies Watches uX0hO4
            [/url]
            [url=http://www.irideonlus.org/node/1758274]Monster Beats By Dr. Dre Studio Headphones oB6jK3
            [/url]
            [url=http://hnxypg.com/plus/view.php?aid=43209]Gucci Watches For Men aR7sY9
            [/url]
            [url=http://xingfu434444.uueasy.com/read.php?tid=2452982]Authentic Bags wP7dS6
            [/url]
            [url=http://www.ameriwal.com/forum.php?mod=viewthread&tid=1081845]Louis Vuitton Personalized Bags jN2cO3
            [/url]
            [url=http://keybb.com/forum.php?mod=viewthread&tid=540132]Chloe Handbags hS5eX5
            [/url]
            [url=http://www.app001.cn/forum.php?mod=viewthread&tid=630130]Fashion Watches For Women bN6rS5
            [/url]
            [url=http://ww.waiji.cc/yechang.co/bbs/forum.php?mod=viewthread&tid=45087]White Watches For Men sA7wT8
            [/url]
            [url=http://bbs.liveuptool.com/forum.php?mod=viewthread&tid=41669]Used Birkin Bags kE0kU7
            [/url]
            [url=http://www.domovie.tv/bbs/home.php?mod=space&uid=49999&do=blog&id=481887]Jewellery Watches iU4uY2
            [/url]

            Anonymous said...

            That is a really good tip particularly to those new to the blogosphere.
            Brief but very accurate information… Many thanks for
            sharing this one. A must read article!

            Here is my web page - payday loans

            Anonymous said...

            You're so interesting! I don't suppose I've read through a single thing like that before. So good to discover another person with a few unique thoughts on this subject. Seriously.. thanks for starting this up. This site is something that's needed on the internet, someone with some originality!
            http://monkeypoundstillpayday.co.uk

            Anonymous said...

            For latest news you have to pay a visit web and on
            the web I found this site as a best web page for most up-to-date updates.


            Feel free to visit my webpage; instant payday loans

            Anonymous said...

            Terrific Web site, Continue the very good work.
            Thanks!

            my website :: instantpaydayloans-now.co.uk

            Anonymous said...

            My programmer is trying to convince me to move to .net
            from PHP. I have always disliked the idea because of the costs.
            But he's tryiong none the less. I've been using WordPress on numerous websites for about a year
            and am nervous about switching to another platform. I have heard fantastic things about blogengine.
            net. Is there a way I can transfer all my
            wordpress content into it? Any help would be greatly appreciated!


            Take a look at my web site ... fast payday loans canada

            Anonymous said...

            Excellent web site. A lot of useful information here. I'm sending it to a few friends ans also sharing in delicious. And of course, thank you to your sweat!

            Visit my homepage; asian betting sites

            Anonymous said...

            Good web site you've got here.. It's difficult to find high quality
            writing like yours nowadays. I truly appreciate individuals like you!
            Take care!!

            My web site ... rtrybula.com