SoFunction
Updated on 2025-04-05

js get all file names (instance) in the file

js get all file names (instance) in the file

Updated: October 17, 2017 08:25:48 Author: Huang Ama
Below, the editor will bring you an article on js to obtain all file names (examples) in the file. The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor

As shown below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
 function init(){
  var fso = new ActiveXObject("");
  // Get file-related information  var f1 = ("F:\\test\\");
  alert('The last file modified date:' + );
  var drv;
  var s = '';
  // Get disk-related information  drv = (("C:\\"));
  s += 'Drive C:' + '-' +  + '\n';
  s += 'Total Space:' +  / 1024 + 'Kb' + '\n';
  s += 'Free Space:' +  / 1024 + 'Kb' + '\n';
  alert('C disk information' + s);
  // Operation folder  fldr = ("F:\\test");
  alert('Parent folder name:' + fldr + '\n');
  // Show the name of the drive  alert("Contained on drive " +  + "\n"); 
  // Determine whether it is the root directory  if (){
   alert("This is the root folder."); 
  }
  else {
   alert("This folder isn't a root folder."); 
  }
  // Create a new folder   ("F:\\test\\Bogus"); 
  alert("Created folder F:\\testBogus" + "\n"); 
  // Show the basic name of the folder, not including the path name  alert("Basename = " + ("F:\\test\\bogus") + "\n"); 
  // Delete the created folder   ("F:\\test\\Bogus"); 
  alert("Deleted folder F:\\test\\Bogus" + "\n"); 
 }
 
 function init2(){
  var fso = new ActiveXObject("");
  // Get all files in the directory. For the browser cache directory, only one file can be obtained  var path = 'C:\\Users\\zhang\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files';
  //path = 'F:\\test';
  var fldr = (path);
  var ff = new Enumerator();
  var s = '';
  var fileArray = new Array();
  var fileName = '';
  var count = 0;
  for(; !(); ()){
   fileName = ().Name + '';
   fileName = ();
   if(('cookie') >= 0){
    fileName = (0,('.'));
    fileName = (('@')+1);
    s += fileName + '\n';
   }
   count++;
  }
  alert(count + ',' + s);
 }
</script>
</head>
<body onload="init2();">
</body>
</html>

The above article js obtains all file names (examples) in the file is all the content I share with you. I hope you can give you a reference and I hope you can support me more.

  • js
  • Get
  • file name

Related Articles

  • Regular expression determines whether Chinese and full-width characters exist and determines that Chinese string lengths are included

    For some more secure fault tolerance, it is necessary to use
    2008-09-09
  • JS implements the relevant drop-down field effect when searching keywords

    There are drop-down fields when searching for keywords, which you will encounter when using Baidu. This example describes the use of js to achieve similar effects.
    2014-08-08
  • JavaScript Design Pattern Learning Factory

    Implementing the factory through an interface, this is to display RSS and other implementation code through List.
    2009-07-07
  • Pure JS carousel diagram

    I have been watching js animation these days. Today I got a carousel picture, which is implemented using pure js, but the appearance style is not very good. If you need it, you can beautify it. The specific implementation code is still very complete. You can refer to it.
    2017-02-02
  • Detailed explanation of the reasons and heartbeat mechanism of JS WebSocket disconnection

    This article mainly introduces the reasons and heartbeat mechanism of JS WebSocket disconnection. Students who are interested in websocket can refer to the following
    2021-05-05
  • js get the Value/Text and selected value of RadioButtonList implementation code

    I believe many friends want to obtain the Value, Text and selected values ​​of RadioButtonList. Next, I will introduce you how to use js to obtain the information. The code is very detailed. If you are interested, you can refer to it. It may be helpful to you.
    2013-03-03
  • How to obtain user information and user mobile number at the same time in WeChat applet

    Mini Program Login is a very common function in mini programs nowadays. Because the official method provides you to obtain user information with one click and get mobile phone numbers with one click. This article mainly introduces to you about how WeChat mini programs can obtain user information and user mobile phone numbers at the same time. Friends who need it can refer to it.
    2021-08-08
  • JavaScript regular expression trigger function for advanced replacement

    If a sub-match is defined in a regular expression, the length of the parameter will change with the number of sub-matches. If no sub-match is defined, the length is fixed.
    2010-03-03
  • A bizarre experience record of JavaScript regular

    Regular expressions are patterns used to match character combinations in strings. The following article mainly introduces a strange experience record of JavaScript regularity. The article introduces the examples in detail. Friends who need it can refer to it.
    2022-04-04
  • JavaScript pop-up form click the button to return to the implementation of selecting data

    I have been trying to achieve this these two days. I used to make a demo, but I don’t know where to go. So today I found some information online and then did it myself. Don't say much nonsense. Go straight to the topic.
    2010-04-04

Latest Comments