Created
November 22, 2019 07:20
-
-
Save trevorfoskett/8112ee59182321501f9244e3da4a975c to your computer and use it in GitHub Desktop.
Check if filename exists and if so, count up for files of same name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 1; | |
var array = fileName.split('.'); | |
var decryptFileName = `${array[0]}.${array[1]}`; | |
while (fs.existsSync(`./decrypt-out/${decryptFileName}`)) { | |
decryptFileName = `${array[0]} (${i}).${array[1]}`; | |
i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment