fm.createDirectory use?

Hello,

If I try that code:

// find or create a named Bookmark  
let bookmark = Bookmark.findOrCreate(bookmarkName);  
let fm = FileManager.createForBookmark(bookmark);
const start = new Date();

// Je localise le dossier de l'année
const yearFolder= "/"+start.getFullYear();
if (!fm.exists(yearFolder)) {
	if (!fm.createDirectory(start.getFullYear(), "/")) {
	 	console.log("Impossible de créer le dossier : "+ yearFolder);
		return false;
	}
}

I got the error:
FileManger.createDirectory: Folder and path string parameters required

I’m not sure to understand the use of FileManger.createDirectory. Does anybody has a sample?

Thanks!

The parameters you are passing are not passing validation, because they are not the right data type. getFullYear() returns an number value, not a string…so you would need to modify that to be start.getFullYear().toString() to pass it as a string value.

@agiletortoise merci beaucoup :smiling_face: !