Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check how many files in a folder js

const { promises: fs } = require('fs');
const dir = '/';

const getNumFiles = async (dir) => {
  const files = await fs.readdir(dir)
  console.log(files.length)
}
getNumFiles(dir)
Source by thewebdev.info #
 
PREVIOUS NEXT
Tagged: #check #files #folder #js
ADD COMMENT
Topic
Name
1+4 =