Create folder

A

Adrian

Hi all,

I have a problem finding a solution to this for a while
and I am no further forward.


Can anyone give me a hint on how to programatically create
a new folder?

I want to create a new folder in "C:\Incompleted\"
called "Images"

Its the understanding of FileSystemObject that has me
foxed. The hep file does not actually tell me what a file
system object is and what I should call it.

Thanks as always

Adrian
 
E

Ed

Hi, Adrian.

This is code that I use with Office 2000 and Win2000. It takes an existing
folder and renames it by adding the date, then creates a new folder. Make
sure you have a reference to Microsoft Scripting Runtime. Also, be aware
that limitations of how you view this may make the lines of code break in
places they shouldn't for correct running.



' Handle folder

Dim fs, a

Set fs = CreateObject("Scripting.FileSystemObject")



' Rename folder

Set a = fs.GetFolder("C:\Documents and Settings\username\Desktop\New
Folder")

a.Name = a.Name & Format(Now, " mmddyy")



' Create new folder

fs.CreateFolder ("C:\Documents and Settings\username\Desktop\New Folder")



HTH

Ed
 
A

Adrian

Hi Perry,

Wow, it doesnt get any easier than that!!

If only you knew how long I have been troubled by this!

Thanks

Adrian
 
J

Jonathan West

Adrian said:
Hi Perry,

Wow, it doesnt get any easier than that!!

If only you knew how long I have been troubled by this!

Just one point to make on Perry's answer. For this line to work

mkdir "c:\Incompleted\Images"

the folder C:\Incompleted must already exist. The command will throw an
error unless the parent folder alreadyy exists.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top