Sideway
output.to from Sideway
Draft for Information Only

Content

File Object
FileObject.Size Property
   Syntax:
   Parameters:
   Returns:
   Remarks:
   Examples:
FileObject.Drive Property
   Syntax:
   Parameters:
   Returns:
   Remarks:
   Examples:
FileObject.Name Property
   Syntax:
   Parameters:
   Returns:
   Remarks:
   Examples:
FileObject.Path Property
   Syntax:
   Parameters:
   Returns:
   Remarks:
   Examples:
FileObject.ShortName Property
   Syntax:
   Parameters:
   Returns:
   Remarks:
   Examples:
FileObject.ShortPath Property
   Syntax:
   Parameters:
   Returns:
   Remarks:
   Examples:
FileObject.Type Property
   Syntax:ax:
   Parameters:rs:
   Returns:ns:
   Remarks:ks:
   Examples:es:

File Object

One key function of FileSystemObject Component is the manipulation of files of the file system.

FileObject.Size Property

FileObject.Size property is a property to to get the size, in bytes, of the file related to the specified file object instance.

Syntax:

FileObjectName.Size

 Or in VBScript. Imply

filesize =FileObjectName.Size

 Or in JScript. Imply

filesize =FileObjectName.Size

Parameters:

filesize

The parameter "filesize" is the name assigned to the value returned by the size property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

Returns:

Value

The return value of the size property is a value in bytes, for all files and subfolders contained in the specified folder object instance.

Remarks:

FileObjectName refers to a File Object. And Folder object is another possible alternate object for the Size property.

Examples:

  • Example of using the Size property to get the size of a file.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, filesize
    Set fso = CreateObject("Scripting.FileSystemObject"))
    Set FileObjectName = fso.GetFile("d:\temp1\test.txt")
    filesize = FileObjectName.Size
    Response.Write filesize & "<br />"
    </script>;

    HTML web page ouput:

    9

  • Example of using the Size property to get the size of a file.

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, FileObjectName, filesize;
    fso = new ActiveXObject("Scripting.FileSystemObject"); ;
    FileObjectName = fso.GetFile("d:\\temp1\\test.txt");
    filesize = FileObjectName.Size 
    Response.Write (filesize+ "<br />");
    </script>t;

    HTML web page ouput:

    9

FileObject.Drive Property

FileObject.Drive property is a read only property to get and return the drive letter on which the specified file object instance resided.

Syntax:

FileObjectName.Drive

 Or in VBScript. Imply

driveletter =FileObjectName.Drive

 Or in JScript. Imply

driveletter =FileObjectName.Drive

Parameters:

driveletter

The parameter "driveletter" is the name assigned to the drive letter returned by the drive property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

Returns:

string

The return value of the drive property is a string of  the letter name representation of the drive on which the specified file object instance resided.

Remarks:

FileObjectName refers to a File Object. And Folder object is another possible alternate object for the Drive property.

Examples:

  • Example of using the Drive property to get the drive letter of a file.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, driveletter
    Set fso = CreateObject("Scripting.FileSystemObject"))
    Set FileObjectName = fso.GetFile("d:\temp1\test.txt")
    driveletter = FileObjectName.Drive
    Response.Write driveletter & "<br />"
    </script>

    HTML web page ouput:

    d:

  • Example of using the Drive property to get the drive letter of a file.

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, FileObjectName, driveletter;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    FileObjectName = fso.GetFile("d:\\temp1\\test.txt");
    driveletter = FileObjectName.Drive 
    Response.Write (driveletter+ "<br />");
    </script>

    HTML web page ouput:

    d:

FileObject.Name Property

FileObject.Name property is a read/write property to set and return the name of the specified file object instance.

Syntax:

FileObjectName.Name [= newname]

 Or in VBScript. Imply

filename =FileObjectName.Name

FileObjectName.Name =newfilename

 Or in JScript. Imply

filename =FileObjectName.Name

FileObjectName.Name =newfilename

Parameters:

filename

The parameter "filename" is the name assigned to the string returned by the Name property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

newfilename

The optional parameter "newfilename" is used to specify the new file name to be assigned by the Name property to the file name referred to the specified File object.

Returns:

string

The return value of the Name property is the string of existing file name refered to the specified file object instance.

Remarks:

FileObjectName refers to a File Object.  And Folder object is another possible alternate object for the Name property.

Examples:

  • Example of using the Name property to get and set the name of the specified file.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, filename
    Set fso = CreateObject("Scripting.FileSystemObject"))
    Set FileObjectName = fso.GetFile("d:\temp1\test.txt")
    filename= FileObjectName.Name
    Response.Write filename & "<br />"
    FileObjectName.Name="test1.txt"
    Response.Write  FileObjectName.Name & "<br />"
    </script>;

    HTML web page output

    test.txt
    test1.txt

  • Example of using the Name property to get and set the name of the specified file.

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, FileObjectName, filename;
    fso = new ActiveXObject("Scripting.FileSystemObject"); );
    FileObjectName = fso.GetFile("d:\\temp1\\test.txt");
    filename = FileObjectName.Name
    Response.Write (filename+ "<br />");
    FileObjectName.Name ="test1.txt"
    Response.Write (FileObjectName.Name+ "<br />");
    </script>>

    HTML web page outputML web page output

    test.txt
    test1.txt

FileObject.Path Property

FileObject.Path property is a property to get and return the path of the specified file object instance.

Syntax:

FileObjectName.Path

 Or in VBScript. Imply

filepath =FileObjectName.Path

 Or in JScript. Imply

filepath =FileObjectName.Path

Parameters:

filepath

The parameter "filepath" is the name assigned to the string returned by the Name property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

Returns:

string

The return value of the Path property is the string of path refered to the specified file object instance.

Remarks:

FileObjectName refers to a File Object.  And Folder and Drive objects are another possible alternate objects for the Path property.

Examples:

  • Example of using the Path property to get the path of the specified file.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, filepath
    Set fso = CreateObject("Scripting.FileSystemObject"))
    Set FileObjectName = fso.GetFile("d:\temp1\test1.txt")
    filepath= FileObjectName.Path
    Response.Write filepath & "<br />"
    </script>;

    HTML web page output

    D:\temp1\test1.txt

  • Example of using the Path property to get the path of the specified file.

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, FileObjectName, filepath;
    fso = new ActiveXObject("Scripting.FileSystemObject"); ;
    FileObjectName = fso.GetFile("d:\\temp1\\test1.txt");
    filepath = FileObjectName.Path
    Response.Write (filepath+ "<br />");
    </script>t;

    HTML web page output

    D:\temp1\test1.txt

FileObject.ShortName Property

FileObject.ShortName property is a property to get and return the short name converntion for programs that require the earlier 8.3  naming format of the specified file object instance.

Syntax:

FileObjectName.ShortName

 Or in VBScript. Imply

fileshortname =FileObjectName.ShortName

 Or in JScript. Imply

fileshortname =FileObjectName.ShortName

Parameters:

fileshortname

The parameter "fileshortname" is the name assigned to the string returned by the ShortName property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

Returns:

string

The return value of the ShortName property is the string of the 8.3 naming convention of a file name refered to the specified file object instance.

Remarks:

FileObjectName refers to a File Object.  And Folder object is another possible alternate object for the ShortName property.

Examples:

  • Example of using the ShortName property to get the shortname of the specified file.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, fileshortname
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set FileObjectName = fso.GetFile("d:\temp1\test1longname.txt")
    Response.Write FileObjectName.Name & "<br />"
    fileshortname= FileObjectName.ShortName
    Response.Write fileshortname & "<br />"
    </script>script>

    HTML web page output:

    test1longname.txt
    TEST1L~1.TXT

  • Example of using the ShortName property to get the shortname of the specified file.

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, FileObjectName, fileshortname;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    FileObjectName = fso.GetFile("d:\\temp1\\test1longname.txt");
    Response.Write (FileObjectName.Name+ "<br />");
    fileshortname = FileObjectName.ShortName
    Response.Write (fileshortname+ "<br />");
    </script>script>

    HTML web page output:

    test1longname.txt
    TEST1L~1.TXT

FileObject.ShortPath Property

FileObject.ShortPath property is a property to get and return the short path converntion for programs that require the earlier 8.3  naming format, of the specified file object instance.

Syntax:

FileObjectName.ShortPath

 Or in VBScript. Implyipt. Imply

fileshortpath =FileObjectName.ShortPath

 Or in JScript. Implyipt. Imply

fileshortpath =FileObjectName.ShortPath

Parameters:

fileshortpath

The parameter "fileshortpath" is the name assigned to the string returned by the ShortName property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

Returns:

string

The return value of the ShortPath property is the string of the 8.3 naming convention of the path refered to the specified file object instance.

Remarks:

FileObjectName refers to a File Object.  And Folder object is another possible alternate object for the ShortPath property.

Examples:

  • Example of using the ShortPath property to get the short path format of the path of the specified file.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, fileshortpath
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set FileObjectName = fso.GetFile("d:\templongname\test1longname.txt")
    Response.Write FileObjectName.Path & "<br />"
    fileshortpath= FileObjectName.ShortPath
    Response.Write fileshortpath & "<br />"
    </script>;

    HTML web page output:

    D:\templongname\test1longname.txt
    D:\TEMPLO~1\TEST1L~1.TXT

  • Example of using the ShortPath property to get the short path format of the path of the specified folder.

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, FileObjectName, fileshortpath;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    FileObjectName = fso.GetFile("d:\\templongname\\test1longname.txt");
    Response.Write (FileObjectName.Path+ "<br />");
    fileshortpath = FileObjectName.ShortPath
    Response.Write (fileshortpath+ "<br />");
    </script>

    HTML web page outputput

    D:\templongname\test1longname.txt
    D:\TEMPLO~1\TEST1L~1.TXT

FileObject.Type Property

FileObject.Type property is a property to get and return the information type of the specified file object instance.

Syntax:ax:

FileObjectName.Type

 Or in VBScript. Implyply

filetype =FileObjectName.Type

 Or in JScript. Implyply

filetype =FileObjectName.Type

Parameters:rs:

filetype

The parameter "filetype" is the name assigned to the string returned by the Type property referred to the specified File object.

FileObjectName

The parameter "FileObjectName" is used to specify the name of the instance of the File Object related to.

Returns:ns:

string

The return value of the Type property is the string of the information type of the specified file object instance.

Remarks:ks:

FileObjectName refers to a File Object.  And Folder object is another possible alternate object for the Type property.

Examples:es:

  • Example of using the Type property to get the information type of the specified file.

    ASP VBScript command:nd:

    <script runat="server" language="VBScript">
    Dim fso, FileObjectName, infotype
    Set fso = CreateObject("Scripting.FileSystemObject")t;)
    Set FileObjectName = fso.GetFile("d:\temp1\test1.txt")
    infotype= FileObjectName.Type
    Response.Write infotype & "<br />"
    Response.Write fso.GetFile("d:\temp1\test.7z").Type & "<br />"
    </script>gt;

    HTML web page output

    Text Document
    WinRAR archive

  • Example of using the Type property to get the information type of the specified file.

    ASP JScript command:nd:

    <script runat="server" language="JScript">
    var fso, FileObjectName, infotype;
    fso = new ActiveXObject("Scripting.FileSystemObject"); FileObjectName = fso.GetFile("d:\\temp1\\test1.txt");
    infotype = FileObjectName.Type infotype = FileObjectName.Type Response.Write (infotype+ "<br />");
    Response.Write (fso.GetFile("d:\\temp1\\test.7z").Type+"<br />");
    </script>
    </script>

    Text Document
    WinRAR archive


©sideway

ID: 130500013 Last Updated: 5/14/2013 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019