Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code is below:-
---------------
ASP.NET
<%@ Page Language="C#" Debug = "true" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

1.<html xmlns="http://www.w3.org/1999/xhtml" >
2.<head  runat="server">
3.    <title>Untitled Page</title>
4.    <script language="javascript" type="text/javascript">
5.    debugger;
6.    
7.        var fs,fo;
8.        fs=new ActiveXObject("Scripting.FileSystemObject")
9.        fo=fs.GetFolder('D:\\Picture')
10.        for (var x in fo.files)
11.        {
12.           Response.write(x.Name + "<br />")
13.        }
14.</head>
15.<body>

My above code is not working properly.
at the line no 10, the dubgger is vanish, whenever i debugging step by step. No error msg shown.
Why?

Is above code is wrong?
If wrong so please code supply to me that i read the file name of the folder using java scripts.

Please Please help me anybody for above problems.
Posted
Updated 6-Oct-12 6:11am
v2

1 solution

Based on discussion here: recursive javascript to list all files/folders in a given folder...[^]

Following should work:
JavaScript
var WshShell = WScript.CreateObject ("WScript.Shell");
var fs, otf, ForAppending;
ForAppending = 8;
fs = new ActiveXObject("Scripting.FileSystemObject");
otf = fs.OpenTextFile(WshShell.CurrentDirectory+"\\folderList5.txt", ForAppending, true);


var fso
fso = new ActiveXObject("Scripting.FileSystemObject");
createFolderList(WshShell.CurrentDirectory); //Start and pass in current directory
otf.Close(); //Close File for writing.


function createFolderList(folderspec)
{
  var f = fso.GetFolder(folderspec);
  var fc = new Enumerator(f.SubFolders);
  for (; !fc.atEnd(); fc.moveNext())
  {
    otf.WriteLine(fc.item() + "\r\n");
    createFolderList(fc.item());
  }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900