|
ASP
Components >> AdvDirectory
|
Download | Buy |
AdvDirectory
|
AdvDirectory is a
component designed for web based directory management. When
the component is turned on for a new website, it takes physical
path, which is usually the web root of that website. All file
management operations are restricted to the physical path
mentioned in ASPFusion Administration thus rest of server
remains unaffected. It enables you to do ...
|
Complete basic directory management
operations, such as Create, Delete and Rename a directory.
|
|
Along with these basic operations, it provides
List operation to get listing of all files and directories
under the given path, and return their Attributes, Size,
Creation Date, Last Modified Date and Type, and also can
sort the listing in ascending and descending on given
sorting criteria. |
|
Sample
code for C++, ASP and CF is provided with the component
Example (ASP):
<% set Obj = Server.CreateObject("AdvDirectory.Directory")
%>
Example (ColdFusion):
<CFOBJECT
Class="AdvDirectory.Directory"
Action="Create"
Name="Obj">
AdvDirectory Properties
Property |
Description |
Dot
|
Set
this property to inform AdvDirectory component whether
to return "." or ".." directories in case
of listing. Valid values are
TRUE if this value is set
as TRUE then component will return "." and ".."
directories
FALSE (default)
if this value is set as FALSE then component will not
return "." and ".." directories
Example (ASP):
<% Obj.Dot = true %>
Example (ColdFusion):
<CFSET Obj.Dot = true>
|
ErrorReason |
Reports
any error that occurred during the request.
Example (ASP):
<% if Obj.IsError = 1 then
Response.Write
Obj.ErrorReason
else
No Error
Occurred
end if %>
Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
<CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
<CFOUTPUT>No
Error Occurred</CFOUTPUT>
</CFIF>
|
Filter
|
File
extension filter is applied on returned names, e.g.
"*.asp". Only one mask filter can be applied
at a time. If not specified then default filter value
"*.*" is used.
Example (ASP):
<% Obj.Filter =
"*.asp" %>
Example (ColdFusion):
<CFSET Obj.Filter = "*.asp">
|
IsError
|
Returns
1 if any error occurred during the request otherwise
0.
Example (ASP):
<% if Obj.IsError = 1 then
Response.Write
Obj.ErrorReason
else
No Error
Occurred
end if %>
Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
<CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
<CFOUTPUT>No
Error Occurred</CFOUTPUT>
</CFIF>
|
Sort
|
List
of query columns to sort directory listing. Valid values
are
Name_ASC (default)
Name_DESC
Size_ASC
Size_DESC
Type_ASC
Type_DESC
Attributes_ASC
Attributes_DESC
DateLastModified_ASC
DateLastModified_DESC
DateCreated_ASC
DateCreated_DESC
Example (ASP):
<% Obj.Sort = "type_asc"
%>
Example (ColdFusion):
<CFSET Obj.Sort = "type_asc">
|
AdvDirectory
Methods
Method |
Parameter |
Return Value |
Description |
Create
|
1.
Directory Path |
None
|
Create
the given directory.
Example (ASP):
<% Obj.Create("c:\myfolder")
%>
Example (ColdFusion):
<CFSET Obj.Create("c:\myfolder")>
|
Delete
|
1.
Directory Path |
None
|
Delete
the given directory.
Example (ASP):
<% Obj.Delete("c:\myfolder")
%>
Example (ColdFusion):
<CFSET Obj.Delete("c:\myfolder")>
|
List
|
1.
Directory Path |
Array
of objects |
Return
listing of the given directory.
Example (ASP):
<% set Result = Obj.List("c:\myfolder")
for each Member in
Result
Response.Write
Member.Name
Response.Write
Member.Type
Response.Write
Member.Size
Response.Write
Member.Attributes
Response.Write
Member.DateLastModified
Response.Write
Member.DateCreated
next
set Result = nothing %>
Example (ColdFusion):
<CFSET Result = Obj.List("c:\myfolder")>
<CFLOOP Collection="#Result#"
Item="Member">
<CFOUTPUT>
#Member.Name#
#Member.Type#
#Member.Size#
#Member.Attributes#
#Member.DateLastModified#
#Member.DateCreated#
</CFOUTPUT>
</CFLOOP>
WHERE in List collection
Name |
contains name of the directory or file.
|
Type |
contains type, whether it is a file or directory.
|
Size |
contains size of the file.
|
Attributes |
contains file or directory attributes.
|
DateLastModified |
contains last modified date and time.
|
DateCreated |
contains date and time created.
|
|
Rename
|
1.
Old Directory Name
2. New Directory Name |
None
|
Rename
the given directory.
Example (ASP):
<% Obj.Rename "c:\myoldfolder",
"c:\mynewfolder" %>
Example (ColdFusion):
<CFSET Obj.Rename("c:\myoldfolder", "c:\mynewfolder")>
|
|
|