Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Newsletter
Enter your email address to receive full length articles at Stardeveloper:


Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (43)
  ADO (16)
  ADO.NET (11)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)

Main Category  Other
  Website Maintenance (3)
Log In
UserName Or Email:

Password:

Auto-Login:

Hosted by Securewebs.com
 
Home : .NET : ASP : Working with Drives, Folders and Files in ASP
 
Read full length articles at Stardeveloper using Twitter Follow on Twitter Facebook Facebook fan page Email Get Articles via Email RSS Get Articles via RSS Feed

Methods for working with files.

Method Description
CopyFile(source, destination, overwrite) Copies the from source to destination.
CreateTextFile(name, overwrite, unicode) Creates a new text file with specified name. If overwrite parameter is set to True, any existing file with the same name is overwritten.
DeleteFile(name, force) Deletes the file with specified name.
FileExists(name) Returns True if file exists and False if not.
GetBaseName(path) Returns name of the file from the specified path.
GetExtensionName(name) Returns extension of the given file.
GetFile(name) Returns a File object of the file name specified.
GetFileName(pathandname) Returns only name of the file.
GetTempName() Returns a randomly generated temporary file name.
MoveFile(source, destination) Moves the file from source to destination.
OpenTextFile(name, iomode, create, format) Opens a file and returns TextStream object. iomode can be ForReading(1), ForWriting(2) or ForAppending(8). Default is ForReading(1). If create is set to True then a new file will be created if file with given name is not found.

Properties of Drive Object
Properties of Drive.

Property Description
AvailableSpace Returns amount of space available to this user on this drive.
DriveLetter Returns drive letter.
DriveType Returns type of drive which may be Unknown(0), Removable(1), Fixed(2), Network(3), CD-ROM(4) or RamDisk(5).
FileSystem Returns type of file system on the drive.
FreeSpace Returns amount of free space available on the drive.
IsReady Returns True if drive is ready else False.
Path Returns path of the drive.
RootFolder Returns root Folder object for the drive.
SerialNumber Returns serial number for the drive.
ShareName Returns network share name if it is a network drive.
TotalSize Returns total size in bytes of the drive.
VolumeName Sets or returns volume name for the drive.

There are no methods associated with Drive object.

Properties and Methods of Folder Object
Properties of Folder.

Property Description
Attributes Returns attributes for the folder which may be Normal(0), ReadOnly(1), Hidden(2), System(4), Volume(name)(8), Directory(folder)(16), Archive(32), Alias(64) or Compressed(128).
DateCreated Returns date and time when folder was created.
DateLastAccessed Returns date and time when folder was last accessed.
DateLastModified Returns date and time when folder was last modified.
Drive Returns drive letter of the drive where folder exists.
Files Returns a Files collection of all the files present under that folder.
IsRootFolder Returns True if current folder is root folder for the drive else returns False.
Name Returns name of the folder.
ParentFolder Returns Folder object for the parent folder.
Path Returns complete path for the folder.
ShortName Returns DOS style 8.3 version of folder name.
ShortPath Returns DOS style 8.3 version of folder path.
Size Returns size of the folder in bytes.
SubFolders Returns a collection of Folder objects present under the current folder.
Type Returns a descriptive string for the current folder.

Methods of Folder.

Method Description
Copy(destination, overwrite) Copies all the files and sub folders of current folder to destination.
Delete(force) Deletes the current folder.
Move(destination) Moves the folder to destination.
CreateTextFile(name, overwrite, unicode) Creates a new text file under the current folder. If overwrite argument is True then existing file with same name is deleted. unicode argument is optional.

Previous ( 2 Gone )( 1 Remaining ) Next

Comments/Questions ( Threads: 26, Comments: 39 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. Copy images in Access on to the hard disk
  2. plz help me
  3. Determined folder of the drive D
  4. Urgent!! problem with listing files ( 1 Reply )
  5. Trouble Accessing DLL files Thru ASP
  6. Need assistance with directory creation please.... ( 1 Reply )
  7. Permission to Folder
  8. Not able to read contents from file.
  9. How to read/write a textfile; coding in Windows XP/IIS
  10. Web Drive
  11. Network Drives
  12. Want to display files in a folder sorted by date created? ( 2 Replies )
  13. Listing Folders in Dropdown menu ( 1 Reply )
  14. Is Great!
  15. display folders within folders
  16. it doesnt work?
  17. Permission Denied on root of C drive
  18. This is great stuff ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  19. Attach a file to an Email From Database
  20. adding/creating a new folder ( 2 Replies )
  21. Disk is not ready??
  22. error with getfolder method ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  23. Errors using IIS in Windows 2000 Professional ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  24. filesysytem objects ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  25. How to read a delimeted(delimeter ||) text file ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  26. Exactly what I was looking for ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed.

 
© 1999 - 2010 Stardeveloper.com, All Rights Reserved.