Windows.vbs.FSO. File manipulation Information-disk-driven information-complete collection of folder operation Information _vbs

Source: Internet
Author: User
Source Address:
Http://www.zhouguoqing.com.cn/article.asp?id=50

' FSO file operation related
' FSO parameter detailed:
' Fso.isrootfolder=true| False ' is the root directory
' Fso.getfolder ' reads folder usage: Set Fldr = Fso. GetFolder ("c:\\ directory 2")
' Fso.folderexists=true| False ' Find out if this folder exists
' Fso.createfolder ' creates folder usage: Fso. CreateFolder ("c:\\ directory 1")
' Fso.getbasename ' Returns the name usage of the folder: Fso. Getbasename ("c:\\ directory 1")
' Fso.deletefolder ' deletes the specified folder usage: Fso. DeleteFolder ("c:\\ directory 1")
' Fso.movefolder ' moves the specified folder usage: Fso. MoveFolder ("c:\\ directory 1", "c:\\ Directory 2") moves c:\\ directory 1 to c:\\ directory 2
' Fso.copyfolder ' copies the specified folder usage: Fso. CopyFolder ("c:\\ directory 2\\cnbruce", "c:\\") copies c:\\ directory 2\\cnbruce to c:\\
'
' Fso.drive ' Returns the name of the drive back to "D:"
' Fso.getdrivename ' extracts the drive name back to "D:"
' Fso.getdrive ' extracts the drive name back to "D:" The commonly used wording: Fso. Getdrive (FSO. GetDriveName (Drvpath))
' Disk drive information
' Drv.driveletter ' return letter
' Drv.volumename ' gets the volume label of the drive
' Drv.totalsize ' gets the total size of the space to return the number of bytes, formatted with FormatNumber (drive.totalsize/1024,0), returns how many G
' Drv.freespace ' remaining space size returned to ditto
' drv.drivetype ' file type 0 device does not recognize "1" Floppy disk drive "2" Hard Drive "3" Network Hard Drive "4" optical drive 5 "RAM Virtual Disk"
' Drv.filesystem ' disk format
' Drv.serialnumber ' disk serial number
Whether ' Drv.isready ' is available
' Drv.path ' disk path
'
' FSO file operation
' Txt.opentextfile ' opens the specified file usage: FSO. OpenTextFile (whichfile,1) Parameter 1: "ForReading: Read only, Forbidden to write." "Parameter 2:" ForWriting: readable, writable. "Parameter 8:" ForAppending: Open the file and start writing from the end of the file
' Txt.readline ' reads a whole line
' Txt.read (7) ' reads the specified number of characters
' Txt.readall ' reads all text
' txt.createtextfile ' Create file usage: Set MyFile = Txt.createtextfile (whichfile,true) True means overwrite existing file
' Txt.writeline ' writes content usage to existing files: Txt.writeline ("Welcome to this site")
' Txt.name ' Returns the name of the file
' Txt.shortpath ' returns the short path name of the file
' Txt.path ' returns the physical address of the file
' txt.attributes ' returns file properties
' Return value Appendix:
' Normal 0 normal file. No properties are set
' ReadOnly 1 read-only file. can read and write
' Hidden 2 hidden files. can read and write
' System 4 systems files. can read and write
' Directory 16 folder or directory. Read-only
' Archive 32 files that have changed since the last backup. can read and write
' Alias 1024 link or shortcut. Read-only
' Compressed 2048 compressed files. Read-only
'
' Txt.move ' moves the specified file usage: Set Txt = fso. GetFile (whichfile) txt.move "c:\\"
' Txt.copy ' copies the specified file usage: Set Txt = fso. GetFile (whichfile) txt.copy "d:\\"
' Txt.delete ' deletes the specified file usage: Set Txt = fso. GetFile ("D:\\cnbruce.txt") txt.delete
'
'
' Txt.size ' returns the file size
' Txt.type ' returns the file type
' txt.datecreated ' Returns the time the file was created
' txt.datelastaccessed ' Returns the last access time of the file
' Txt.datelastmodified ' returns the last modified time of the file
'
'
' Common function records
' InStr ' Usage: Alert (InStr ("Abcde", "A"))
' Mid ' Usage: Alert (Mid ("ABJDLLODFJD", 2,8) Description: Displays the character from the second to the 8th position
'
'------------------------------------------------
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.