Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=130500013

Size / Drive / Name / Path / ShortName / ShortPath / Type, File Object, ASP Server Component, Built-in Function

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

Link:http://output.to/sideway/default.asp?qno=130500010

ProduKey

Nirsoft ProduKey

ProduKey is a utility program to display the ProductID and the CD-Key of Microsoft Program from nirsoft.net.

The graphic interface of FolderChangeView from nirsoft.net  :

image

Site of Nirsoft

  • NirSoft - freeware utilities: password recovery, system utilities, desktop utilities http://www.nirsoft.net/ last updated 7/24/2017

Links of ProduKey

The FolderChangeView can be downloaded at
http://www.nirsoft.net/utils/produkey.zip

Previous Month  MAY  2013  Next Month
SMTWTFS
1234
567891011
12131415161718
19202122232425
262728293031

Previous Month  JAN  2011  Next Month
SMTWTFS
1
2345678
9101112131415
16171819202122
23242526272829
3031

Sideway BICK Blog

13/05


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013