-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathExportSourceFiles.ps1
26 lines (22 loc) · 1.22 KB
/
ExportSourceFiles.ps1
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
# Define source and destination directories
$source = "C:\Users\doola\OneDrive\Documents\Github\Basis Foundation\Basis Unity\Basis Server"
$destination = "C:\Users\doola\OneDrive\Documents\Github\Basis Foundation\Basis Unity\Basis\Packages\com.basis.server"
# Remove all .cs files in the destination directory
Get-ChildItem -Path $destination -Recurse -Include *.cs | Remove-Item -Force
# Get all files from the source, excluding .dll files, .asmdef files, and obj folders
Get-ChildItem -Path $source -Recurse | Where-Object {
# Exclude .dll files, .asmdef files, and obj directories
$_.Extension -notin @('.dll', '.asmdef') -and $_.FullName -notmatch '\\obj\\'
} | ForEach-Object {
# Calculate the destination file path
$destinationPath = $_.FullName -replace [regex]::Escape($source), $destination
# Ensure the destination folder exists
$destinationFolder = [System.IO.Path]::GetDirectoryName($destinationPath)
if (-not (Test-Path -Path $destinationFolder)) {
New-Item -ItemType Directory -Path $destinationFolder -Force
}
# Copy the file to the destination
if (-not $_.PSIsContainer) { # Ensure it's not a directory
Copy-Item -Path $_.FullName -Destination $destinationPath -Force
}
}