-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalle_Module.ps1
More file actions
23 lines (19 loc) · 940 Bytes
/
alle_Module.ps1
File metadata and controls
23 lines (19 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Definiert das Ausgangsverzeichnis und die finale requirements.txt Datei
$OutputDir = Get-Location
$FinalReqFile = Join-Path -Path $OutputDir -ChildPath "requirements.txt"
# Falls die finale requirements.txt Datei existiert, wird sie gelöscht
if (Test-Path $FinalReqFile) {
Remove-Item $FinalReqFile
}
# Durchsucht das Ausgangsverzeichnis und alle Unterverzeichnisse
Get-ChildItem -Path $OutputDir -Recurse -Directory | ForEach-Object {
# Führt pipreqs für jedes Verzeichnis aus
pipreqs $_.FullName --force
# Fügt die Inhalte der erzeugten requirements.txt Dateien zur finalen requirements.txt Datei hinzu
$ReqFile = Join-Path -Path $_.FullName -ChildPath "requirements.txt"
if (Test-Path $ReqFile) {
Get-Content $ReqFile | Out-File -Append -FilePath $FinalReqFile
# Löscht die erzeugte requirements.txt Datei im Unterverzeichnis
Remove-Item $ReqFile
}
}