Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
587 B
3
Indexable
Never
function myFunction() {
  const folder = DriveApp.getFolderById('1IdcFDiRy0Ykznx6gLjAQSAZe8rrjkLHj');
  const files = folder.getFiles();

  const type = 'IOQ';
  const dic = {
    'IOPQ': ['tutorial', 'an toàn', 'service', 'iopq'],
    'IOQ': ['tutorial', 'an toàn', 'service'],
  };

  const fileNames = [];
  while (files.hasNext()) {
    const file = files.next();
    const fileName = file.getName();
    fileNames.push(fileName);
  }

  const passed = dic[type].every(x => fileNames.join('|').toLowerCase().includes(x.toLowerCase()));
  console.log(passed);
}