Last active
August 19, 2022 19:26
-
-
Save Eboubaker/176c12983150f4d468dd8976e6f10543 to your computer and use it in GitHub Desktop.
Serve files in the current directory to the network.
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 | |
$files = array_diff(scandir('.'), ['.', '..', 'index.php']); | |
if(empty($files)) die("no files in directory ."); | |
foreach ($files as $f) { | |
echo "<div style='font-size: 1.3em;padding-left: 15px'><a href='$f'>$f</a></div>"; | |
} |
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
@echo off | |
xcopy %~dp0\index.php "%cd%" /Y | |
php -S 0.0.0.0:2000 -t "%cd%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put index.php in the same folder as serve.bat.
then add server.bat to PATH.
then call command
serve
anywhere to serve any files in the cmd directory to the network on port 2000.