As a lecturer ICT I have to correct the work our students make. Therefor I collect all solutions and put them in a subfolder-organised structure on disk: per student I create a subfolder and put their solution into that folder(*).
$ tree -L 1 . ├── student1 ├── student2 ├── ... └── studentN
As – from the 2nd year on – most of our projects use some sort of dependency manager I often found myself manually
cding into folders and running the command to install the dependencies.
Today I knocked up a one-liner to install all PHP dependencies (using Composer) in subfolder-organised projects. My first attempt was pretty awful, yet with a hint by Frank I eventually cleaned it up:
find . -name composer.json -maxdepth 2 -execdir composer install \;
With some minor modifications the command can also be used to installing dependencies using
find . -name package.json -maxdepth 2 -execdir npm install \;
(*) actually, a
handy app created by a colleague of mine does this automatically for me, but that’s not the gist of this post
I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!