1

Step1 : need to zip below three files in same location with holds.zip Path: D:\Project\extensions\files inside this path having households filefolder xmldocument dll need to zip the file with these three files Step2:once zipped(holds.zip) delete the zip file and copy in D:\Project\extensions

using this command but not getting the required output Compress-Archive -Path D:\Project\extensions\files -DestinationPath D:\Project\extensions\files

1 Answer 1

2

I tried re-creating the scenario you mentioned as follows:

Created a directory "D:\Project\extensions\files" that contains the following items:

  1. A File Folder named "datadocs"
  2. An XML file named "script.xml"
  3. A DLL file named "config.dll"

enter image description here

I executed the below PS script and it archived the folder contents in same location:

$compress = @{
  Path = "D:\Project\extensions\files"
  CompressionLevel = "Fastest"
  DestinationPath = "D:\Project\extensions\files\holds.zip"
}
Compress-Archive @compress

enter image description here

Once the zip file was generated, I used the below cmdlet to delete it & move to "D:\Project\extensions" path:

Move-Item "D:\Project\extensions\files\holds.zip" "D:\Project\extensions\holds.zip"

enter image description here

Hope this solution meets your requirements!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.