एएसपी फ़ाइल वस्तु
फ़ाइल ऑब्जेक्ट का उपयोग किसी निर्दिष्ट फ़ाइल के बारे में जानकारी वापस करने के लिए किया जाता है।
और ज्यादा उदाहरण
दिनांक और समय कैसे प्राप्त करें एक निर्दिष्ट फ़ाइल को अंतिम बार संशोधित किया गया था।
दिनांक और समय कैसे प्राप्त करें एक निर्दिष्ट फ़ाइल को अंतिम बार एक्सेस किया गया था।
की विशेषताएँ कैसे लौटाएँ।
फ़ाइल वस्तु
फ़ाइल ऑब्जेक्ट का उपयोग किसी निर्दिष्ट फ़ाइल के बारे में जानकारी वापस करने के लिए किया जाता है।
फ़ाइल ऑब्जेक्ट के गुणों और विधियों के साथ काम करने के लिए, आपको FileSystemObject ऑब्जेक्ट के माध्यम से फ़ाइल ऑब्जेक्ट का एक उदाहरण बनाना होगा। प्रथम; FileSystemObject ऑब्जेक्ट बनाएं और फिर FileSystemObject ऑब्जेक्ट की GetFile विधि या फ़ोल्डर ऑब्जेक्ट की Files प्रॉपर्टी के माध्यम से फ़ाइल ऑब्जेक्ट को तुरंत चालू करें।
निम्न कोड फ़ाइल ऑब्जेक्ट को तुरंत चालू करने के लिए FileSystemObject ऑब्जेक्ट की GetFile विधि का उपयोग करता है और निर्दिष्ट फ़ाइल बनाए जाने की तारीख वापस करने के लिए DateCreated गुण का उपयोग करता है:
उदाहरण
<%
Dim fs,f
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\test.txt")
Response.Write("File created: " & f.DateCreated)
set f=nothing
set fs=nothing
%>
फ़ाइल ऑब्जेक्ट के गुण और विधियाँ नीचे वर्णित हैं:
गुण
Property | Description |
---|---|
Attributes | Sets or returns the attributes of a specified file |
DateCreated | Returns the date and time when a specified file was created |
DateLastAccessed | Returns the date and time when a specified file was last accessed |
DateLastModified | Returns the date and time when a specified file was last modified |
Drive | Returns the drive letter of the drive where a specified file or folder resides |
Name | Sets or returns the name of a specified file |
ParentFolder | Returns the folder object for the parent of the specified file |
Path | Returns the path for a specified file |
ShortName | Returns the short name of a specified file (the 8.3 naming convention) |
ShortPath | Returns the short path of a specified file (the 8.3 naming convention) |
Size | Returns the size, in bytes, of a specified file |
Type | Returns the type of a specified file |
तरीकों
Method | Description |
---|---|
Copy | Copies a specified file from one location to another |
Delete | Deletes a specified file |
Move | Moves a specified file from one location to another |
OpenAsTextStream | Opens a specified file and returns a TextStream object to access the file |