MSI Factory 2.3

Folder.Create

Folder.Create

This is the first topic This is the last topic  

Folder.Create

This is the first topic This is the last topic  

OverviewExamples

Folder.Create (

string Folder )

Example 1

Folder.Create("C:\\Stored");

Creates a new folder called "Stored" on the user's C: drive.

Example 2

-- Get the path to the user's My Documents folder.

myDocsFolder = Shell.GetFolder(SHF_MYDOCUMENTS);

 

-- Create a folder in the user's My Documents folder.

Folder.Create(myDocsFolder.."\\New");

 

-- Show the status dialog.

StatusDlg.Show();

 

-- Move all files from the "Old" folder to the "New" folder.

File.Move(myDocsFolder.."\\Old\\*.*", myDocsFolder.."\\New", true, true, false, false, nil);

 

-- Check to see if the files moved successfully by getting the error code.

error = Application.GetLastError();

 

-- Hide the status dialog.

StatusDlg.Hide();

 

-- If there was an error, display the error message.

-- If no error occurred, open the folder to view the moved files.

if (error ~= 0) then

   Dialog.Message("Error", _tblErrorMessages[error], MB_OKCANCEL, MB_ICONEXCLAMATION);

else

   File.ExploreFolder(myDocsFolder.."\\New");

end

This example first creates a new folder in the user's My Documents folder called "New." The File.Move action is then called to move all files from an existing folder called "Old" to the folder called "New." If the file move fails, the error code message is shown and if it succeeds, the folder is opened in an explore window.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us