3

I have this scenario to reproduce an HTML implementation for 100+ images of different names.

myPackageDirectory
- index.html
- some_name.png
- script/css files


Currently, I have to manually do the following

  1. pick each image file from pool,
  2. place it into the packageDirectory, then
  3. rename it to static img.png, then
  4. package(zip) the iteration.


I wish to skip renaming part from xyz.png --> img.png by something like
<img src="*.png" /> kind of thing.
"Client-side method"

I've used python to automate iterations, but
am looking for some html/js way to pick file just by extension

  • 1
    or [this answer](https://stackoverflow.com/a/32511953/2996989) – Ahmed Sunny Jan 21 '20 at 10:40
  • @AhmedSunny — Your first comment links to a solution specific to SmartBear's TestComplete Desktop Application. It doesn't seem applicable. – Quentin Jan 21 '20 at 10:44
  • @AhmedSunny — Your second comment links to a Node.js implementation, but the question says html/js which implies the JS is running client-side in the browser and not in Node.js. – Quentin Jan 21 '20 at 10:44
  • sorry for that, i misread your question, but js and html are client side languages, and accessing directory and files on server you need server side language like PHP. – Ahmed Sunny Jan 21 '20 at 10:47

1 Answers1

0

It seems you want to obtain a list of file names on the server with the .png extension.

If your server allows directory listing, you can do this with client side JavaScript. Otherwise, you'll need a server side solution.

See the answers here: Easiest way to get list of files in the server directory

terrymorse
  • 6,771
  • 1
  • 21
  • 27