Skip to content

Instantly share code, notes, and snippets.

@xcriptus
Created December 9, 2012 20:34
Show Gist options
  • Save xcriptus/4246855 to your computer and use it in GitHub Desktop.
Save xcriptus/4246855 to your computer and use it in GitHub Desktop.
StarUML - FileSystem
var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
filesystem.FolderExists(folderName))
folder = filesystem.CreateFolder(folderName);
filesystem.CopyFolder(sourcoldername, targetfoldername);
file = filesystem.CreateTextFile(filename, true, false);
file.WriteLine("<HTML>");
file.Close();
------------------------------------------------------------------------------------
Files, Directories and Path
------------------------------------------------------------------------------------
http://www.webreference.com/js/column71/index.html
The FileSystemObject object provides access to the computer's file system components such as files, folders, and drives. Here are the object's methods and property (only one property, drives):
BuildPath()
Assembles a file path
CopyFile()
Copies a file from one folder to another
CopyFolder()
Copies a folder from one folder to another
CreateFolder()
Creates a new folder
CreateTextFile()
Creates a new text file
DeleteFile()
Deletes a file
DeleteFolder()
Deletes a folder
DriveExists()
Checks whether a drive exists
Drives
Returns a collection of all drive objects
FileExists()
Checks whether a file exists
FolderExists()
Checks whether a folder exists
GetAbsolutePathName()
Returns the absolute path name for a file
GetBaseName()
Returns the file name without its path and without its extension
GetDrive()
Returns the drive name of a specified letter drive
GetDriveName()
Returns the drive name of a letter drive
GetExtensionName()
Returns the extension of a file
GetFile()
Returns a file object
GetFileName()
Extracts a file name from a given path
GetFolder()
Returns the folder name of a given file
GetParentFolderName
Returns the parent folder name of a given folder or a file
GetSpecialFolder()
Returns a name for a special folder
GetTempName()
Returns a randomly-generated name
MoveFile()
Moves a file from one folder to another
MoveFolder()
Moves a folder from one folder to another
OpenTextFile()
Opens a text file stream to a file
--------------------------------------------------------------------------------
TextStream
--------------------------------------------------------------------------------
To create an instance of the TextStream object you can use the CreateTextFile or OpenTextFile methods of the FileSystemObject object, or you can use the OpenAsTextStream method of the File object.
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt")
f.write("Hello World!")
f.close
The TextStream object's properties and methods are described below:
Property
--------
AtEndOfLine
Returns true if the file pointer is positioned immediately before
the end-of-line marker in a TextStream file, and false if not
AtEndOfStream
Returns true if the file pointer is at the end of a TextStream file,
and false if not
Column
Returns the column number of the current character position in an input stream
Line
Returns the current line number in a TextStream file
Methods
-------
Close
Closes an open TextStream file
Read
Reads a specified number of characters from a TextStream file and
returns the result
ReadAll
Reads an entire TextStream file and returns the result
ReadLine
Reads one line from a TextStream file and returns the result
Skip
Skips a specified number of characters when reading a TextStream file
SkipLine
Skips the next line when reading a TextStream file
Write
Writes a specified text to a TextStream file
WriteLine
Writes a specified text and a new-line character to a TextStream file
WriteBlankLines
Writes a specified number of new-line character to a TextStream file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment