The DocsList no longer works and has been replaced by the DriveAPI , Google App Services and Advanced Google services .
Here I leave my test code , this code creates folders - subfolders - google files - pdf - and stores them in folders and subfolders in various ways, and I hope will be helpful
function Drive_2015() { //busca un folder, si no lo hay lo crea y crea 2 sub carpetas un google document copiado en cada una de ellas
var name='folder de prueba';
var carpeta = DriveApp.getRootFolder().searchFolders("title contains '"+name+"'");
if (carpeta.hasNext()===true) {
while (carpeta.hasNext()) {
var folder = carpeta.next();
Logger.log(folder.getName()+' '+folder.getId());
}
}else{
var folder=DriveApp.getRootFolder().createFolder(name);
var parent=DriveApp.getFolderById(folder.getId()); // get parent folder
var folder2 =parent.createFolder('Subfolder'); // 1° way to create sub folder
var folder3=folder.createFolder(name+1);// 2° way to create sub folder (and more easy)
var doc = DocumentApp.create('Documento sta');
var sheet = SpreadsheetApp.create('Spreadsheet sta');
Utilities.sleep(300); // este retardo es para garantizar en el user-side la creacion del nuevo archivo
var files = DriveApp.getFilesByName('Documento sta');// or Id var file = DriveApp.getFileById(doc.getId());
while (files.hasNext()) {
var file = files.next();
Logger.log('ojo '+file.getName());
file.makeCopy(folder3);
file.makeCopy(folder2);
var file2=file.makeCopy(folder);
file2.setName('Acta individual del alumno')
var blob = file2.getAs('application/pdf');
var file2pdf = folder.createFile(blob);
var file2pdf = DriveApp.getFileById(file2pdf.getId());
var file2pdf=file2pdf.makeCopy(folder);
Logger.log('se creó: '+file.getName()+' en la carpeta: '+folder.getName()+' el PDF es: '+file2pdf.getId());
DriveApp.getFileById(file2pdf.getId()).setTrashed(true)
DriveApp.getFileById(docid).setTrashed(true)
}
}
}