A Bash script to recursively generate a list of all files in a directory and save the result to files.json.
Common build/cache directories like node_modules, build, and .cache are automatically skipped.
curl -s https://raw.githubusercontent.com/dicodingacademy/file-path-generator/refs/heads/main/exec.sh | bash -s -- .These directories are ignored by default:
node_modules,.npm,.yarn,.pnpm-storebuild,dist,.build,.dist,out,.output.next,.nuxt,.svelte-kit,.vite,.angularcache,.cache,.parcel-cache,.turbo,.gradlevendor,target,bin,obj,.cargo.github,.gitlab,.terraform,.git
The full list can be found in the
SKIP_DIRSarray within the script.
files.json structure:
[
"src/index.js",
"public/favicon.ico",
"app/config/settings.json"
]Add more skip directories by editing the script:
SKIP_DIRS+=( "folder-name" )Q: Is this only for JavaScript/Node projects?
A: No. It works for any project or directory structure.
Q: Do I need sudo?
A: Only if you need access to restricted directories.
Feel free to use, modify, and distribute this script as you wish.