Create new directory folder/subfolder ionic/vuejs

Hello to all,
i am unable to create a subfolder inside a folder in one step, can you help me understand? This is how it works

import { File } from '@ionic-native/file';

createDirectory{
File.createDir(File.externalRootDirectory,'folder', true);
}

I would like to do something like that, but it doesn’t work

    import { File } from '@ionic-native/file';

    createDirectory{
    File.createDir(File.externalRootDirectory,'folder/subfolder', true);
    }

sorry my english and thanks for the help

Hi,could you please help me? I’ve been going crazy for many days, but unfortunately I can’t find the solution :frowning:
A thousand thanks

How about trying File system of Capacitor?
https://capacitorjs.com/docs/apis/filesystem#mkdir

Would you have an example to take a cue? Have patience, but I’m new to programming.
I’m using ionic-vue-javascript, all the examples I find are about react and angular

Ok ok finally I got there

import { Filesystem,Directory  } from '@capacitor/filesystem';

  data() {
    return {
     directory : Directory.Documents,     
    }
  },

method:{
   createFolder() {   
     Filesystem.mkdir({
     directory: this.directory,
     path: 'folder/subfolder/2subfolder', recursive: true,
    });
}
}


Thanks very much for the advice

1 Like