0

I'm trying to compress file:

 [io.compression.zipfile]::CreateFromDirectory("E:\YYY Software\mmmm\file.csv","E:\YYY\aaa\file.zip")

but I get the error:

Exception calling "CreateFromDirectory" with "2" argument(s): "The directory name is invalid '

I think is due to is a file and not a directory?

henrycarteruk
  • 12,708
  • 2
  • 36
  • 40
Luis perez
  • 133
  • 3
  • 17

1 Answers1

0

In PowerShell 5.0 onwards, Compress-Archive is available:

Compress-Archive -Path "E:\YYY Software\mmmm\file.csv" -DestinationPath "E:\YYY\aaa\file.zip"
G42
  • 9,791
  • 2
  • 19
  • 34