Changed hardcoded settings to variables

This commit is contained in:
Frank Bischof 2023-03-24 09:40:58 +01:00
parent 7b6aabeabd
commit e94677fad5
2 changed files with 6 additions and 9 deletions

5
.gitignore vendored
View File

@ -1,5 +0,0 @@
*
!7zip_to_netapp_v2.ps1
!README.md
!CHANGELOG
!.gitignore

View File

@ -1,12 +1,14 @@
# 7zip_to_netapp_v2.ps1
# Author: F. Bischof (frank@meer-web.nl)
# Version 2.4.0
# Version 2.5.0
# Set global vars
$CSV = "C:\MyCSVFile.csv"
$LOGFILE = "C:\MyCSVFile.$TIMESTAMP.log"
# Set script vars
$TIMESTAMP = Get-Date -Format "yyyyMMddHHmm"
$TARGET_FILENAME = "${TIMESTAMP}-archive.7z"
$CSV = "C:\Scripts\compress and move\dfs04zip.csv"
$LOGFILE = "C:\Scripts\compress and move\$TIMESTAMP.log"
# Writelog function
if (!(test-path $LOGFILE)) {
@ -24,7 +26,7 @@ WRITELOG "=========================== Archiving started ========================
# Check if CSV file exists
if (test-path $CSV) {
WRITELOG "Loading CSV file $CSV"
$CSVFILE = import-csv -Path 'C:\Scripts\compress and move\dfs04zip.csv'
$CSVFILE = import-csv -Path "${CSV}"
} else {
WRITELOG "CSV file not found! ($CSV)"
Write-Output "$CSV does not exists!"