0

I have an array with documents paths, is there any way to go through the array and to rename each file on the disk using JavaScript?

For example:

var arr=["../images/1.pdf","../images/2.pdf","../images/3.pdf"];

Desired output:

var arr=["../images/a.pdf","../images/b.pdf","../images/c.pdf"];
9
  • 3
    Indeed there is a way. What did you try? Commented Feb 13, 2017 at 16:24
  • @FanyoSILIADIN, not sure what you mean, I simply don't know if it's possible or not. Commented Feb 13, 2017 at 16:25
  • 1
    What do you mean by "rename each file on the disk" Commented Feb 13, 2017 at 16:26
  • Is this JS in the browser? Support for this isn't great if so as it's considered a security risk. Commented Feb 13, 2017 at 16:26
  • @j08691, actually changing the name of each file. Commented Feb 13, 2017 at 16:27

1 Answer 1

2

It doesn't matter if you'r using Javascript or not, however it does matter if you'r running in a browser or not.

You can't just access files on the disk from a Browser, but this is totally possible for example from node.js or an electron application, and maybe for a browser addon and other VMs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.