Created
September 18, 2022 08:33
-
-
Save ivuorinen/d7ddf52308b727c5e8ad862f5fec403b to your computer and use it in GitHub Desktop.
Remove all vendor and node_modules folders from cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
system("df -H"); | |
echo "\n\n"; | |
$d = glob(__DIR__ . '/*'); | |
sort($d); | |
$removable = [ | |
'vendor', | |
'node_modules' | |
]; | |
foreach ($d as $folder) { | |
if (!is_dir($folder)) { | |
continue; | |
} | |
echo print_r($folder, true) . "\n"; | |
foreach ($removable as $item) { | |
$f = $folder . DIRECTORY_SEPARATOR . $item; | |
if (!file_exists($f)) { | |
continue; | |
} | |
echo " -> (!) Removing: " . $f . "\n"; | |
system("rm -rf $f"); | |
echo "\n"; | |
} | |
} | |
echo "\n\n"; | |
system("df -H"); | |
echo "\n\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment