
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
foreach-folder
Advanced tools
A CLI utility to execute the same command in every subfolder of the current folder.
This command-line utility executes the same command for every subfolder of the current folder.
The stdout and stderr of every execution is shown.
If the command execution fails for one subfolder, the execution goes to the next subfolder and continues.
npm install -g foreach-folderyarn global add foreach-folder (if you have yarn installed)Open the Terminal / Prompt
Navigate to the target folder
execute forfo "<command>"
Let's pretend you have this folder structure:
parent
|----child1
|----child2
and you want to create a x.txt file in every subfolder.
Navigate to the folder parent with:
cd <path>/<to>/parent
Execute:
forfo "touch x.txt"
Now the folder structure is:
parent
|----child1
| |----x.txt
|----child2
|----x.txt
You have a Node project in every subfolder, and you want to install the dependencies of every project:
forfo "yarn install"
You have a group of directories with different Git repositories, and you want to pull them all in once:
forfo "git pull"
You want to list all the depth-0 elements in all the subfolders:
forfo ls
Or, for Windows:
forfo dir
(For a more powerful folder explorer, use the the tree utility instead).
The command is executed for every folder SEQUENTIALLY, i.e. before executing for folder2, the command must have finished its execution in folder1, etc.
That means you cannot use this tool to run both a server and a client app in a full-stack application: the command will be stuck in the execution of - for example - the server until the server is shutdown, thus the client will never start.
Parallel execution is scheduled for the next version.
Any advise or contribution is welcome.
FAQs
A CLI utility to execute the same command in every subfolder of the current folder.
We found that foreach-folder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.