-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.ps1
More file actions
74 lines (64 loc) · 1.79 KB
/
Copy pathsync.ps1
File metadata and controls
74 lines (64 loc) · 1.79 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
param(
[string]$SourceRoot = $PSScriptRoot,
[string]$DriveRoot = $env:SENTINELX_DRIVE_ROOT,
[string]$RepoSubdir = "repo"
)
$ErrorActionPreference = "Stop"
if ([string]::IsNullOrWhiteSpace($DriveRoot)) {
throw "Set -DriveRoot or the SENTINELX_DRIVE_ROOT environment variable to your Google Drive Sentinel-X folder."
}
$source = (Resolve-Path -LiteralPath $SourceRoot).Path
$targetRoot = Join-Path $DriveRoot $RepoSubdir
if (-not (Test-Path -LiteralPath $source)) {
throw "Source repo not found: $source"
}
New-Item -ItemType Directory -Force -Path $targetRoot | Out-Null
$copyItems = @(
"backend",
"frontend",
"ai",
"docs",
".gitignore",
"CLAUDE.md",
"docker-compose.yml",
"README.md"
)
$excludeDirs = @(
".git",
"node_modules",
"dist",
".venv",
"__pycache__",
"ai\artifacts\sentinelx_remote_sensing",
"ai\datasets\remote_sensing_assets"
)
foreach ($item in $copyItems) {
$src = Join-Path $source $item
if (-not (Test-Path -LiteralPath $src)) {
continue
}
$dst = Join-Path $targetRoot $item
if (Test-Path -LiteralPath $src -PathType Container) {
New-Item -ItemType Directory -Force -Path $dst | Out-Null
$robocopyArgs = @(
$src,
$dst,
"/E",
"/XO",
"/FFT",
"/R:1",
"/W:1"
)
foreach ($exclude in $excludeDirs) {
$robocopyArgs += "/XD"
$robocopyArgs += (Join-Path $source $exclude)
}
& robocopy @robocopyArgs | Out-Null
if ($LASTEXITCODE -ge 8) {
throw "Robocopy failed for $item with exit code $LASTEXITCODE"
}
} else {
Copy-Item -LiteralPath $src -Destination $dst -Force
}
}
Write-Host "Synced Sentinel-X to $targetRoot"