How to write subfolders to PersistentDataPath iOS

So at runtime I need to be able to store downloaded data on the iOS device so I can use at later times. I want to keep things organized so I don’t have to use a weird naming convention.

How can I create a subdirectory in Application.PersistentDataPath for iPhone?

I thought I could do something like this but I get a error through xcode saying it can’t find the directory.

string path = Application.persistentDataPath +"/localData/" + character.Name + ".xml";
StreamWriter fileWriter = File.CreateText(path);
fileWriter.WriteLine("Hello world");
fileWriter.Close();  

Debug.Log(File.ReadAllText(path));

Thanks danny but I a different way to do it and forgot to update this.

Here’s what I did if anyone needs to know

DirectoryInfo dirInf = new DirectoryInfo(Application.persistentDataPath + “/” + “localPet”);
if(!dirInf.Exists){
Debug.Log (“Creating subdirectory”);
dirInf.Create();
}

Try:

string path = Application.dataPath + "/Raw/" + fileName;