Projects and files and text generation

I have what I think is a simple project. I want to use atom to manage a tree of files, a project. At a specific time I want to walk all the files in the tree that have names that match a simple reg-ex, and gather up data from those files and when finished use that data to generate a new file at the root level of the project.

Before I go to far down this path I just wanted someone to validate that his would be a good fit for implementation by creating an atom package.

My suggestion is that this task … treewalker … does not warrant adding yet another package to the cast of thousands. Why not just run a python script using a treewalker?

My first thought was to write an awk script that ran using find, but I wasn’t clear on how to link that into an appropriate event on the tree, or if that even makes sense. I could I guess just hook into a git pre-commit hook.

Of course, it’s most comfortable to stay within one app, but even within that scope there are countless possibilities to achieve what you’re after. You could trigger external apps or scripts from within Atom or you could do it all natively in JavaScript. It’s not only a question of your level or expertise in JavaScript, but there might be other factors such as your project-size. If, for example, you need to walk over a very huge number of files and folders, you likely want to use an external app writing in a compiled language such as Rust (take a look at fd) or any flavour of C.

However, since this is the Atom forum and Atom is extensible through JavaScript, let me give you some hints on how to achive this in pure JavaScript:

// See
import globby from 'globby';

// Take note that this *might* return multiple paths
const projectPaths = atom.project.getPaths();

// Let's look for all un-minified JavaScript files,
// excluding the node_modules folder
const filePattern = [

// In a package you will want to use an async function instead!
(async () => {
  const results = await globby(filePattern, { cwd: projectPaths[0] });


If you want to do this periodically, e.g. whenever your project-folder changes, look at libraries such as chokidar.

Hope this helps to get you going!

For some perspective: I’m using the example above to “glob” my entire Atom packages folder:

Found 37971 files in 381.55908203125ms