Sponsored Links

Login Form






Lost Password?

Syndicate

Home
Create Folders from a list in an .xls Spreadsheet PDF Print E-mail
User Rating: / 4
PoorBest 
Written by Cheyenne Harden   
I needed to create over 300 folders with specific file names.
These names were listed in an excel doc and I didn't want to create the folders by hand.
This script will create folders based on the listed text in an excel file.

----------COPY EVERYTHING BELOW THIS LINE for the Script----------
'This script will create folders based on the listed text in an excel file.
' Created by Chey Harden 7.6.07

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\Test.xls") 'put the path to the .xls file here
objExcel.Visible = False

i = 1

Do Until objExcel.Cells(i, 1).Value = "" ' first value is row (i), second value is the column (1)
   
    strNewFolderName = objExcel.Cells(i, 1).Value
   
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 Set objFolder = objFSO.CreateFolder("C:\scripts\" & strNewFolderName) 'Location to create the folders

    i = i + 1
Loop

 

 

----------COPY EVERYTHING ABOVE THIS LINE for the Script----------

 

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!

To make this script work you will need the items below!


1. Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\Test.xls") 'put the path to the .xls file here
2. Do Until objExcel.Cells(i, 1).Value = "" ' first value is row (i), second value is the column (1)
3. Set objFolder = objFSO.CreateFolder("C:\scripts\" & strNewFolderName) 'Location to create the folders


This information is provided "AS IS" with no warranties expressed or implied.

Comments
Add NewSearch
john davies   | 87.127.48.xxx | 21-01-2008 12:15:31
Hi Chey

Great script did the job - any idea on how to get subfolders created after the master folder list ? ie create folder 1 - if folder 1 exists the create subfolders from column 2 ?

Regards John
ceharden - Subfolder...   | Publisher | 29-02-2008 13:42:15
Huh, I don't know that one.
It gets trickier with the if statement.

~Chey
wholesale beads - wholesalb beads     | 222.131.25.xxx | 20-11-2008 03:28:27
wholesale jewelry
handmade jewelry
handcrafted jewelry
jewelry wholesale
wholesale handmade jewelry
pearl jewelry
wholesale pearl jewelry
wholesale turquoise jewelry
wholesale coral jewelry
wholesale shell jewelry
wholesale gemstone jewelry
wholesale crystal jewelry
fashion jewelry
wholesale jewellry
[url=h...
album   | 125.70.59.xxx | 11-11-2008 23:46:41
These days It waswholesale furniture always a bad weather. Since spring is coming, it
fashion jewelry - fashion jewelry     | 222.131.25.xxx | 20-11-2008 03:29:50
wholesale jewelry
jewelry store
fashion jewelry
crystal jewelry
jewelry wholesale
pearl jewelry
wholesale crystal
wholesale pearl
wholesale turquoise
wholesale semi-precious jewelry
wholesale coral
wholesale shell
wholesale swarovski crystal
ailsa   | 125.70.59.xxx | 11-11-2008 23:48:59
High pressure blower
Industrial fan
Industrial blower
Commercial blower
pressure blower
pressure blowers
fans
blowers
ugg boots
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
 
Security Image
Please input the anti-spam code that you can read in the image.

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Tag it:
Delicious
Furl it!
Spurl
digg
YahooMyWeb
< Prev   Next >
 

Google Search

Google