0

I already have code that can iterate through the files once they have been renamed 0.xml, 1.xml, 2.xml etc.

var promises = [];
for (i = 0; i < numberOfFiles; i++) {
    promises.push(xmlPromise('data/sequence/xml/'+i+'.xml'));
}

However, if possible, I would like to keep the original names and iterate through (20180828-110359.369_I01_0000905_wt_calib.ppm3_croped.xml, 20180828-110359.436_I01_0000907_wt_calib.ppm3_croped.xml etc.)

user3071257
  • 37
  • 1
  • 7
  • You might consider fetching a list of files from the server via [AJAX](https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started) and iterating through those. See [How can I iterate through files in Javascript](https://stackoverflow.com/a/2358810/924299). – showdev Nov 12 '18 at 23:58
  • Where are you running this code , on server or in browser? – charlietfl Nov 13 '18 at 00:03
  • There's no way for you to loop through them without getting a list of file names. So far it looks like you don't know the file names which is why you need to rename each file to integers so you can increment through them. Depending on how you handle your code, a single gap on the increment or a mis-renamed file is already a huge problem. Like @showdev said, you need to get the list of files. – Abana Clara Nov 13 '18 at 00:05
  • It's run through the local host: http://127.0.0.1/ – user3071257 Nov 13 '18 at 00:06

0 Answers0