Cacomania: tag

Cacomania

Merging files together with the PowerShell

Guido Krömer - 1784 days ago - Tags: , ,

After playing a round with TypeScript, I needed a way for merging all those single files together. Performing this task with Bash is quite simple. Under Windows there is no Bash, but a thing called PowerShell. The PowerShell has got a large amount of Bash like aliases, which makes the move from Bash to PowerShel really simple, as you can see in the script below.

$TARGET_FILE = "Full.ts"

rm $TARGET_FILE 

$FILES = ls -Recurse -Filter "*.ts"

foreach ($FILE in $FILES) {
  cat $file.FullName >> $TARGET_FILE 
}

tsc $TARGET_FILE

Comment