[Javascript] in the early stage, system operations were performed under. net. The implementation of the same functions was very complicated. I did not expect that javascript would be so simple, so I searched the code online and improved it. [Javascript] function PathList (path) {var fso = new ActiveXObject ("Scripting. fileSystemObject "); var fldr = fso. getFolder (path); var fd = new Enumerator (fldr. subFolders); (;! Fd. atEnd (); fd. moveNext () {sd = fd. item (); WScript. echo (sd. path); // write the writeFile (". text ", sd. path); // document. write (sd. path); PathList (sd. path) ;}} function FileList (path) {var fso = new ActiveXObject ("Scripting. fileSystemObject "); var fldr = fso. getFolder (path); var fd = new Enumerator (fldr. subFolders); (;! Fd. atEnd (); fd. moveNext () {sd = fd. item (); var fc = new Enumerator (sd. files); (;! Fc. atEnd (); fc. moveNext () {WScript. echo (fc. item (); writeFile ("B. text ", fc. item ();} WScript. echo (sd. path); // write the writeFile (". text ", sd. path); // document. write (sd. path); FileList (sd. path) ;}// the current directory file function CurFileList (path) {var fso = new ActiveXObject ("Scripting. fileSystemObject "); var fldr = fso. getFolder (path); var fc = new Enumerator (fldr. files); (;! Fc. atEnd (); fc. moveNext () {WScript. echo (fc. item (); writeFile ("c. text ", fc. item () ;}}/* object. openTextFile (filename [, iomode [, create [, format]) is required for the object parameter. The object should be the name of FileSystemObject. Filename is required. Specifies the string expression of the file to be opened. Iomode is optional. It can be one of the three constants: ForReading, ForWriting, or ForAppending. Create option. Boolean value, indicating whether to create a new file when the specified filename does not exist. If a new file is created, the value is True. If the file is not created, the value is False. If not, no new file is created. Format is optional. Use one of the three-state values to specify the file opening format. If ignored, the file is opened in ASCII format. Set the iomode parameter to any of the following settings: constant value description ForReading 1 open the file in read-only mode. This file cannot be written. ForWriting 2 open the file in write mode ForAppending 8 open the file and write from the end of the file. The format parameter can be any of the following settings: value description TristateTrue open a file in Unicode format. TristateFalse open an object in ASCII format. TristateUseDefault: open a file by default. * // Read the file function readFile (filename) {var fso = new ActiveXObject ("Scripting. fileSystemObject "); var f = fso. openTextFile (filename, 1); var s = ""; while (! F. atEndOfStream) s + = f. readLine () + "\ n"; f. close (); return s;} // write the file function writeFile (filename, filecontent) {var fso, f, s; fso = new ActiveXObject ("Scripting. fileSystemObject "); f = fso. openTextFile (filename, 8, true); f. writeLine (filecontent); f. close (); // alert ('OK'); WScript. echo ("written successfully") ;}// delete the file function deleteFile (filename, filecontent) {var fso, f, s; fso = new ActiveXObject ("Scripting. fi LeSystemObject "); f = fso. getFile (filename); f. delete (); // alert ('OK'); WScript. echo ("deleted successfully");} // batch Delete, folder not deleted, the current directory file function DelFileList (path) {var fso = new ActiveXObject ("Scripting. fileSystemObject "); var fldr = fso. getFolder (path); var fd = new Enumerator (fldr. subFolders); (;! Fd. atEnd (); fd. moveNext () {sd = fd. item (); var fc = new Enumerator (sd. files); (;! Fc. atEnd (); fc. moveNext () {WScript. echo (fc. item (); writeFile ("B. text ", fc. item (); fc. item (). delete (); WScript. echo ("deleted successfully");} WScript. echo (sd. path); // write the writeFile (". text ", sd. path); writeFile (". text "," deleted "); // document. write (sd. path); DelFileList (sd. path) ;}}// Delete the current directory file function CurDelFileList (path) {var fso = new ActiveXObject ("Scripting. fileSystemObject "); var fldr = fso. getFolder (path); Var fc = new Enumerator (fldr. files); (;! Fc. atEnd (); fc. moveNext () {WScript. echo (fc. item (); writeFile ("c. text ", fc. item (); fc. item (). delete (); writeFile ("c. text "," deleted successfully ") ;}/ * Drive object is responsible for collecting the content of physical or logical Drive resources in the system. It has the following attributes: l TotalSize: byte) the size of the drive in units. L AvailableSpace or FreeSpace: The drive space in bytes. L DriveLetter: drive letter. L DriveType: Drive Type, value: removable (Mobile Medium), fixed (fixed medium), network (network Resources), CD-ROM or ramdisk. L SerialNumber: the serial number of the drive. L FileSystem: The file system type of the drive. Values: FAT, FAT32, and NTFS. L IsReady: whether the drive is available. L ShareName: Share Name. L VolumeName: the name of the volume label. L Path and RootFolder: The drive Path or root directory name. */Function getDriveinfo () {var fso, drv, s = ""; fso = new ActiveXObject ("Scripting. fileSystemObject "); drv = fso. getDrive (fso. getDriveName ("c: \"); s + = "Drive C:" + "-"; s + = drv. volumeName + "\ n"; s + = "Total Space:" + drv. totalSize/1024; s + = "Kb" + "\ n"; s + = "Free Space:" + drv. freeSpace/1024; s + = "Kb" + "\ n"; WScript. echo (s);} CurFileList ("D: \ web_01"); FileList ("D: \ web_01"); getDriveinfo ();