Skip to content

Instantly share code, notes, and snippets.

@axelkar
Last active August 17, 2025 15:29
Show Gist options
  • Select an option

  • Save axelkar/091eacc34bcd4d6d58d5ac8085bdbf8b to your computer and use it in GitHub Desktop.

Select an option

Save axelkar/091eacc34bcd4d6d58d5ac8085bdbf8b to your computer and use it in GitHub Desktop.
Decompress transparently compressed files on Windows
#!/usr/bin/env nu
export def decompress-dir [
dir: directory = "." # start directory
] {
print $"Entering directory: ($dir), setting not to compress new files and directories"
^compact /U /A $"($dir)/"
ls $dir | where type == file | par-each { |entry|
let path = $dir | path join $entry.name
print $"Decompressing ($path)"
^compact /U /A $path
}
ls $dir | where type == dir | each { |entry|
let path = $dir | path join $entry.name
decompress-dir $path
} | ignore
}
# for usage with `nu ./decompress-dir`
alias main = decompress-dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment