1

My Electron application should be able to get the path to the folder on the computer, scan all the photos and check them for compliance with various parameters - resolution, size, dpi, etc. and mark them if they do not match.

I tried using the standard input element with directory and webkitdirectory parameters. I tested it in a regular browser, not in Electron.

<input type="file" webkitdirectory="" directory="" />

But it doesn't work the way I expected, the browser asks for permission and then selects all the files. I just need a path, and then I want to work with the contents of the folder myself.

I am faced with the fact that I cannot choose the path to the folder and continue to work with its contents.

How can I achieve this in my Electron app?

  • "I cannot choose the path to the folder" – meaning? Do you want your user to choose the folder? Or is it a fixed folder, in which case you already would know the path? – Alexander Leithner Apr 18 '23 at 11:28
  • It's not fixed folder. User have to choose folder and app will scan it and check all photos. – Eujenio Gonzalez Apr 18 '23 at 12:08
  • So, what have you tried then? Please [edit] your question and include code that's not working. If you haven't tried anything, I suggest [reading Electron's documentation](https://www.electronjs.org/docs/latest/api/dialog#dialogshowopendialogbrowserwindow-options), because you can indeed prompt users for a directory. – Alexander Leithner Apr 18 '23 at 12:19
  • checkout the answers here: https://stackoverflow.com/questions/36152857/how-to-get-folder-path-using-electron – Shai Apr 18 '23 at 12:43
  • @Shai Use of a remote module (obsolete Electron remote module or 3rd party) is no longer recommended. Instead, use solution containing IPC. – midnight-coding Apr 18 '23 at 21:18
  • @AlexanderLeithner I have edited my question. Thanks for the link to the required documentation section, I think this is what I need. I still don't know much about Electron, so I don't know much about its API. If you want you can make it answer and i'll choos it as solution. – Eujenio Gonzalez Apr 19 '23 at 13:45

0 Answers0