In powershell it would look something like this:
$file1 = "PATH TO PHP SCRIPT"
$file2 = "PATH TO JAVASCRIPT"
foreach($directory in (get-childitem "PATH TO ROOT DIRECTORY YOU WANT TO COPY" -recurse| ?{$_.PSIsContainer}))
{
copy-item $file1,$file2 $directory
}
The (get-childitem "PATH TO ROOT DIRECTORY YOU WANT TO COPY" -recurse | ?{$_.PSIsContainer})
line will get all directories under the root directory you are searching in. The -recurse
switch says to go through the entire directory. When we say {$_.PSIsContainer}
we are saying only return the objects that are directories, not files.
Example:
$file1 = "C:\phpScript.txt"
$file2 = "C:\javaScript.txt"
foreach($directory in (get-childitem "C:\CopyToDirectory" -recurse | ?{$_.PSIsContainer}))
{
copy-item $file1,$file2 $directory
}
Or if you wanted to do it in one line, it would look like this:
get-childitem C:\CopyToDirectory -recurse | ?{$_.PSIsContainer} | %{copy-item C:\phpScript.txt,C:\javaScript.txt $_}
Here are the commands used
Get-ChildItem
Copy-Item
For-Each
A similar question