Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $baseTargetPath = '/var/www/target';
- $baseSourcePath = '/var/www/sources';
- $sources = scandir($baseSourcePath);
- $counter = 0;
- $MAX_COUNT = 1000;
- foreach ($sources as $filename) {
- $fullSourcePath = $baseSourcePath . '/' . $filename;
- $fullTargetPath = $baseTargetPath . '/' . $filename;
- if (in_array($filename, ['.', '..']) || is_dir($fullSourcePath) || file_exists($fullTargetPath)) {
- continue;
- }
- symlink($fullSourcePath, $fullTargetPath);
- $counter++;
- if ($counter >= $MAX_COUNT) break;
- }
- var_dump(scandir($baseTargetPath));
Advertisement
Add Comment
Please, Sign In to add comment