beautypg.com

Dwfile.createfolder(), Dwfile.exists() – Adobe Dreamweaver API Reference CS5 User Manual

Page 11

background image

6

DREAMWEAVER API REFERENCE

The file I/O API

Last updated 8/27/2013

var fileURL = "file:///c|/Config/myconfig.cfg";

var newURL ="file:///c|/Config/myconfig_backup.cfg";
DWfile.copy(fileURL, newURL);

DWfile.createFolder()

Availability
Dreamweaver 2.

Description
This function creates a folder at the specified location.

Arguments
folderURL

The folderURL argument, which is expressed as a file:// URL, is the location of the folder you want to create.

Returns
A Boolean value:

true

if the folder is created successfully;

false

otherwise.

Example
The following code tries to create a folder called tempFolder at the top level of the C drive and displays an alert box
that indicates whether the operation was successful:

var folderURL = "file:///c|/tempFolder";

if (DWfile.createFolder(folderURL)){

alert("Created " + folderURL);

}else{

alert("Unable to create " + folderURL);

}

DWfile.exists()

Availability
Dreamweaver 2.

Description
This function tests for the existence of the specified file.

Arguments
fileURL

The fileURL argument, which is expressed as a file:// URL, is the requested file.

Returns
A Boolean value:

true

if the file exists;

false

otherwise.

Example
The following code checks for the mydata.txt file and displays an alert message that tells the user whether the file exists: