C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Listing Folder Contents using Javascript


Posted Date: 06 Jun 2008    Resource Type: Code Snippets    Category: Javascript

Posted By: srilu       Member Level: Diamond
Rating:     Points: 7



The following sample script lists all the items in a folder.It requires ActiveX Controls to be enabled in your browser.To enable them


  • go to Tools>InternetOptions>Security>CustomLevel>ActiveXControls and Plugins
  • enable all the required options


Write the following javascript function in your .aspx page and call it during a button click or page load event.


var fileNameArray= new Array();
count=0;
function GetItemsInFolder()
{
var FSO = new ActiveXObject("Scripting.FileSystemObject");
FolderObj = FSO.GetFolder("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures");
fileArr=FolderObj.Files
var files = new Enumerator(FolderObj.Files);
for (; !files.atEnd(); files.moveNext())
{
fileName=''+files.item();
fileNameArray[count]=fileName;
count++;
}
str='Number of files: '+fileNameArray.length+'

';
for (var i=0;i{
str+=fileNameArray[i]+'
';
}
document.getElementById('TextBox1').value=str;
}







Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Listing files in a given folder  .  List folder contents  .  List fils in a folder  .  List contents of a folder  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Prevent entering special characters using javascript
Previous Resource: Programatically Firing Events in Javascript
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

UK Conference calling Company

Contact Us    Privacy Policy    Terms Of Use