Author Topic: Create a folder that does not exist  (Read 766 times)

Malic

  • Full Member
  • ***
  • Posts: 105
Create a folder that does not exist
« on: January 03, 2020, 04:00:26 AM »
Have made a command for Elite: Dangerous that works like a Star Trek Captains log, where it will activate dictation and take what you say, and output it to a text file with the in game date (3306 01 03.txt) for example.

Right now I have it outputting to {%USERPROFILE%}\Documents\ED_CaptLogs but if the ED_CaptLogs folder does not exist, how do I make it?  I had to make it manually for it to be able to save anything there and what to streamline it for people when they use my profile for the first time.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Create a folder that does not exist
« Reply #1 on: January 03, 2020, 04:07:39 AM »
Code: [Select]
Run application 'cmd' -with parameters '/c mkdir "%USERPROFILE%\Documents\ED_CaptLogs"' (hidden)

Malic

  • Full Member
  • ***
  • Posts: 105
Re: Create a folder that does not exist
« Reply #2 on: January 05, 2020, 04:41:51 PM »
As an addition to this, how would I be able to check to see if said folder already existed?  Unless it does not matter and if the folder already exists, it wont make Folder 2, 3, etc?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Create a folder that does not exist
« Reply #3 on: January 06, 2020, 01:56:41 AM »
It does not matter. If the folder exists nothing will happen.

You can still check if it exists, if needed for other purposes:
Code: [Select]
Set Text [~dir] to '%USERPROFILE%\Documents\ED_CaptLogs'
Write [Blue] '{STATE_DIRECTORYEXISTS:~dir}' to log