i could've done that the slow way, but writing names down for 2000+ files manually is just wrong
thankx
PS: i tried to do a search for it, but i didn't know that to search for
This is a discussion on is there a way to write the file names in a folder in a text file? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; i could've done that the slow way, but writing names down for 2000+ files manually is just wrong thankx PS: ...
i could've done that the slow way, but writing names down for 2000+ files manually is just wrong
thankx
PS: i tried to do a search for it, but i didn't know that to search for
Last edited by Commander; 08-15-2002 at 02:02 PM.
oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!
MSN :: commander_android@hotmail.com []*[]
If you have windows, then you could try this piece of unadulterated evil
Save as ListFiles.wsf and put in the dir you want to list files for....
Run it and it should create FileListing.txt..
I have used with folder of 2000+ files and it seems to cope...even thoug it is slower than using C++ :0
Code:<PACKAGE> <JOB> <SCRIPT LANGUAGE="JScript"> // // RobJFord 22/6/02 // List Files in Currect Folder // // Get File system try{ var oFS = new ActiveXObject("Scripting.FileSystemObject"); } catch(e){ WScript.Echo("Could not create file system interface"); WScript.Quit(1); } // Get Dir & Files try{ var oThisScript = oFS.GetFile(WScript.ScriptFullName); var oCurrDir = oThisScript.ParentFolder; oThisScript = ""; var oFileCol = new Enumerator(oCurrDir.files); } catch(e){ WScript.Echo("Could not enumerate files"); WScript.Quit(1); } // Create output file and list try{ var oOutputFile = oFS.OpenTextFile (oCurrDir + "\\FileListing.txt",2,"TRUE"); oOutputFile.WriteLine("Listing of " + oCurrDir); oOutputFile.WriteLine(oCurrDir.files.Count + " Files"); for (;!oFileCol.atEnd();oFileCol.moveNext()){ oOutputFile.WriteLine(oFileCol.item()); } WScript.Echo("List Made"); oOutputFile.Close(); } catch(e){ WScript.Echo("Could not list files"); WScript.Quit(1); } oOutputFile = ""; oFS = ""; oFileCol = ""; </SCRIPT> </JOB> </PACKAGE>
thankx guys, that really helped out. i really appreciate it.
oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!
MSN :: commander_android@hotmail.com []*[]