Skip to main content
Known Participant
November 1, 2018
Answered

check if the folder exists

  • November 1, 2018
  • 1 reply
  • 1840 views

I would like to create a script

that selects a folder with the name test

the folder is on the desktop

so I get to the point

if the test folder exists, the warning goes out ok

if the folder does not exist, a warning ko is issued

thank you

This topic has been closed for replies.
Correct answer varDale_undefined

Is this the sort of thing you're after?

   var dt =  "~/Desktop/"

   

    var aFolder= Folder (dt + "/test/")

    if (!aFolder.exists) { alert("no folder")

    } else { alert ("folder exists") }

1 reply

varDale_undefinedCorrect answer
Inspiring
November 1, 2018

Is this the sort of thing you're after?

   var dt =  "~/Desktop/"

   

    var aFolder= Folder (dt + "/test/")

    if (!aFolder.exists) { alert("no folder")

    } else { alert ("folder exists") }

Known Participant
November 1, 2018

works well

a question

if the test folder is in the same folder as the script

how could it be done?

Inspiring
November 1, 2018

Not sure with the script location, but you can for the active document.