title: Google Apps Script: How do I GetID's of all the files in a specific folder, along with the names
body: <p>Relating to: Google Apps Script - Google Drive - Spreadsheet</p>
  
  <p>I am completely new to programming languages.</p>
  
  <p>This is what i am trying to do:</p>
  
  <p>Everyday, create a folder with the syntax yymmdd</p>
  
  <p>In this folder create 50 copies of the spreadsheet "MyTemplate" which is in Google Drive.</p>
  
  <p>Using the following syntax for the filenames: yymmdd-01 to yymmdd-50 then get all the names and the ID's of all these spreadsheets listed in a spreadsheet called yymmdd-IDs</p>
  
  <p>Here is some code I started with but I am struggling finding the right code and syntax.
  Being a newbie I am having a tough time, so any help will be appreciated :)</p>
  
  <pre><code>    function create50copies() {
        var TemplateFile = DocsList.getFileById("0bfdbdfIr_dGNsVndBTnNNeFGtlYXchhrdhrdc");
        var filesFolder = DocsList.getFolder("My Templates");
        var d = new Date();
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1; //Months are zero based
        var curr_year = d.getFullYear(); //how do I get only the last two digits?
        // var curr_year = curry_year.substring(2,2); 
  
        var i;
  
        for (i = 1; i &lt; 4; i++) {
         if ((i) &lt; 10)
         {
         TemplateFile.makeCopy("Id " + curr_year + curr_month + curr_date + "-" + "0" + i).addToFolder(filesFolder);
           var ss = SpreadsheetApp.getActiveSpreadsheet();
           Logger.log(ss.getName());
              }
         else{
         TemplateFile.makeCopy("Id " + curr_year + curr_month + curr_date + "-" + i).addToFolder(filesFolder);
             }
  
          // TemplateFile.makeCopy("Id " + curr_year + curr_month + curr_date + "-" + i).addToFolder(filesFolder);
        }
      }
  
      function getids() {
       var files = DocsList.getFilesByType('spreadsheet', 0, 50);
       for (var i = 0; i &lt; files.length; i++) {
         var spreadsheet = SpreadsheetApp.open(files[i]);
         Logger.log(spreadsheet.getName());
         Logger.log(spreadsheet.SpreadsheetApp.getActiveSpreadsheet().getId());
       }
  
      }
  </code></pre>