Questions tagged [compress-archive]

36 questions
1
vote
0 answers

Is it possible to use Compress-Archive using a PSDrive in the -Path and -DestinationPath?

I am using a PSDrive for Compress-Archive but I come across this error: Compress-Archive : The path 'Z:\' either does not exist or is not a valid file system path. At C:\Users\user\somefolder\script.ps1:34 char:5 + Compress-Archive -Path…
japespszx
  • 33
  • 5
1
vote
0 answers

Subdirectories not found after zipping with Powershell

I wrote a PowerShell command to zip a folder and its subdirectories while excluding files from the main directory. When I execute the command it does create the zip file with all subdirectories within, but it doesn't seem to understand that…
Marwann
  • 163
  • 3
  • 14
1
vote
2 answers

How to create a zip file where a file name starts with a dot

I have a situation where I am trying to create a zip file from the command line, but I am trying to add a file which starts with a dot. powershell Compress-Archive -Path .\Dist\._test.txt -DestinationPath .\test But this gives an error Could not…
fotg
  • 639
  • 1
  • 12
  • 25
0
votes
0 answers

DotNetZip IOException cannot extract - file already exists

I have a .zip Archive generated with compress-archive. The archive opens fine with Windows Explorer and extracts fine with 7zip. It has subfolders. On extraction via extractall + overwritesilently, I get a System.IOException saying that the file…
Andreas Reiff
  • 7,961
  • 10
  • 50
  • 104
0
votes
1 answer

Compress-Archive works manually, but not in a .bat file?

I am trying to set up a .bat script to zip specific files in a folder. The input to this script is the folder name. My current .bat file looks like this. REM Takes DATE as input param if "%1"=="" ( echo Provide DATE as an argument ex. 20230425 …
0
votes
2 answers

Needing to have user input for some paths and use relative paths for compressing my folder

I am creating an automation script that should take a user's input for version, package new, and new package path, then compress it into a zip folder. Unfortunately, I can't hardcode the paths, so I'm struggling with how to use relative paths and…
0
votes
0 answers

Powershell/Gitlab-CI - Write Progress during execution of Compress-Archive

My Situation: I'm configuring a gitlab CI Runner, which starts a powershell script. In that Powershell script, I am using the command Compress-Archive and, since the archive I'm compressing has many files, the execution can take upwards of 5…
0
votes
1 answer

Compress multiple directories but exclude directory - Python zipfile(or anything native to Windows 2012+)

I'm looking to find a way to compress multiple directories while excluding a certain directory on several versions of Windows. Unfortunately tar is only available by default on Win 10+ and Compress-Archive doesn't seem to work for me due to it…
Anthony
  • 79
  • 1
  • 1
  • 9
0
votes
1 answer

How do I exclude a subfolder of a subfolder in compress-archive

I want to zip a folder containing files, and subfolders containing more files and more subfolders. But I want exclude just one subfolder of a subfolder. I have seen many various complicated answers but none seem to really work on this…
Anand
  • 4,182
  • 6
  • 42
  • 54
0
votes
2 answers

PowerShell Script (foreach-loop problems)

I have a short question, but I am standing on the wall for too long now, so I have to ask you.... The situation is: I have a special filetype, in different folders and subfolders. I already managed to find the files, write them into a TXT-File and I…
linedan
  • 3
  • 1
0
votes
1 answer

Archiving files according to date in file name. Powershell script

I am trying to make simple powershell script that is archiving files coming in daily. Every file has date at the beggining of its name, for example: 20211220_Something.csv, 20211220_SomethingElse.txt, 20211219_Something.csv,…
0
votes
1 answer

compress-archive task failing in SSIS with 1.25GB file

I am using the 'execute process task' to call the powershell compress-archive command. For small files it works fine. For a file of 1.25GB it is failing. It starts processing then 'finishes' but no file is created. Given that the compress-archive…
adolf garlic
  • 3,034
  • 7
  • 39
  • 54
0
votes
1 answer

Azure devops powershell task issue

Could someone help me with how to zip multiple files using powershell task? I am using a windows vm ..hence couldn't use zip command. I have multiple files which need to be zipped to a particular folder with different name. I tried to do as below,…
priya
  • 391
  • 1
  • 5
  • 24
0
votes
0 answers

Powershell - can't copy and compress from shared folder

I want to achrive content of shared folder, but it's not working with this command: Copy-Item -Path $source -Force -PassThru | Get-ChildItem | Compress-Archive -DestinationPath $destination If $source = C:\MyNormalFolder than it's working, but if I…
0
votes
0 answers

Using Powershell command in batch file using root directory as input and out directory as users desktop

I am trying to run the powershell command "compress-archive" from within a batch file using setlocal cd %~dp0 powershell Compress-Archive "-current directory of batchfile" "%USERPROFILE%\Desktop\Test.zip" This works if I use the literal directories…
Aaron
  • 63
  • 4