Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Dean Moor

Pages: [1]
1
Did you ever find a solution to this problem?
I have discovered the same thing.

2
Thanks anyway Geert, I appreciate the help.

With the code I posted, I can obtain a collection of files showing the file count (which I can confirm matches the directory when changed). Unfortunately, I have not found a way to obtain the individual files from that collection. In Javascript, the collection is not iterable, and every trick I know fails to resolve this state.

3
Thanks for your quick response Geert.
Sadly, your link results in a 404.

In addition, while this is one option that may be available to some, this is not an option for me. The environment is very tightly controlled and obtaining permission to installing additional development tools is extremely unlikely. The best possible solution (if possible) is to leverage Javascript.

Simply put, this script needs to be supportable by others as well, and while an exception could be made for one machine to have additional tools installed, it is far less likely for an entire team.

4
Team,

I am trying to create a script that imports data from a collection of XML files as elements. While I can easily get this working for a single file, I am attempting to get the files from a folder dynamically with the FileSystem Object. This is a piece of cake in VBScript (However, the lack of a debugging environment issue makes this language less than desirable for the large translation scripting!) but can not seem to find a way to iterate through the IFileCollection in JavaScript. Can anyone point me in the right direction?

Code: [Select]
const glDirectory = '\\\\SomeDrive\\SomeFolder\\';
var lcFileList = new Array();
var fsObject = new COMObject( "Scripting.FileSystemObject" );

if (fsObject.FolderExists(glDirectory)){
var fsFolder = fsObject.GetFolder(glDirectory);
if (fsFolder){
var fsFileCollection = fsFolder.Files;
if (fsFileCollection){
//Itterating File Collection & adding to my array for later on.
for (i=0; i<fsFileCollection.Count; i++)
{
var file = fsFolder.Files[i];  //This does not return anything!
lcFileList.push(file); //This errors as file is undefined (aka, not retrieved from the collection.
}
}
}
}

Your help is greatly appreciated.

Pages: [1]