Page 1 of 1

Create a folder on the file system

Posted: June 15th, 2009, 7:11 am
by Redsandro
Hi,

Can I create a folder on the filesystem? I have a script make some changes to some files, but I'd like it to create a subfolder to store the changed files in.
I can read() and write(), but as far as I've found out, I need a File System Object for writing folders. I didn't test if it works but I don't like it because ActiveX is not available everywhere.

Re: Create a folder on the file system

Posted: June 17th, 2009, 3:52 pm
by Yenaphe
Maybe i'm missing something, but AFAIK ActiveX has nothing to do with your script creating folders on your hdd.

In the Javascript Tool Guide CS4 (attached to this post), from page 55 to 60, you have all the informations you need to create, rename, remove,... a folder from within your script.

I don't have time to post an exemple sadly, but i hope this bit of info will still help you

Seb

Re: Create a folder on the file system

Posted: June 17th, 2009, 4:19 pm
by Redsandro
Thanks! Yes it helps me. I actually had that guide (CS3 version) but I forgot about it; I read through the CS3 Scripting Guide instead and couldn't find the info.

I wonder if that's javascript native because the method I knew (ActiveX I was talking about) goes something like this:

Code: Select all

myFSO = new ActiveXObject("Scripting.FileSystemObject");
myFolder = myFSO.CreateFolder ("d:\\cool");