-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloneReposV2.ps1
More file actions
43 lines (33 loc) · 1.02 KB
/
cloneReposV2.ps1
File metadata and controls
43 lines (33 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$repos = @(
"https://github.com/keshavsoft/BackEndGenerator",
"https://github.com/keshavsoft/kschema"
)
# ---------- base folder ----------
$baseFolder = "D:\KeshavSoftRepos"
# ---------- today folder ----------
$todayFolder = Get-Date -Format "yyyy-MM-dd"
# ---------- final target ----------
$targetFolder = Join-Path $baseFolder $todayFolder
# ---------- create base folder ----------
if (!(Test-Path $baseFolder)) {
New-Item -ItemType Directory -Path $baseFolder
}
# ---------- create today folder ----------
if (!(Test-Path $targetFolder)) {
New-Item -ItemType Directory -Path $targetFolder
}
# ---------- move into target ----------
Set-Location $targetFolder
# ---------- clone repos ----------
foreach ($repo in $repos) {
$repoName = ($repo.Split("/") | Select-Object -Last 1)
if (Test-Path $repoName) {
Write-Host "$repoName already exists"
}
else {
Write-Host "Cloning $repoName ..."
git clone $repo
}
}
Write-Host ""
Write-Host "Workspace ready : $targetFolder"