Click here to Skip to main content
13,299,898 members (62,046 online)
Rate this:
Please Sign up or sign in to vote.
See more:
My code is below:-
<%@ Page Language="C#" Debug = "true" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
1.<html xmlns="" >
2.<head  runat="server">
3.    <title>Untitled Page</title>
4.    <script language="javascript" type="text/javascript">
5.    debugger;
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.        }

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.

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 6-Oct-12 1:35am
Updated 6-Oct-12 7:11am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

Following should work:
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");

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100