Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
My code is below:-
---------------
<%@ 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 6-Oct-12 0:35am
Edited 6-Oct-12 6:11am
RaisKazi32.8K
v2

1 solution

Rate this: bad
good
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");
    createFolderList(fc.item());
  }
}
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 370
1 Gihan Liyanage 338
2 Vinay Mistry 160
3 ChauhanAjay 160
4 syed shanu 125
0 Sergey Alexandrovich Kryukov 9,021
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2014
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