0

I've been provided with a list of file paths that need to be zipped (hundreds of files). Without going into each of the directories and manually copying/pasting into another directory and eventually zipping up that directory, is there a command I can run to look for all the file paths I have specified and create a zip with them as the contents?

Using Windows Server 2008, can use standard Windows zip or 7zip. Basically, right now I have a text file containing all the paths that need to be zipped. E.g.

C:\Resources\LabAutomationEmail\test.csv

E:\Resources\LabAutomationEmail\example.csv

D:\Resources\LabAutomationEmail\anotherexample.csv

So if I could someone pass this text file in as a parameter to a command which will look at all the files in the text file and zip them up to a destination folder then my goal would be achieved.

3
  • What operating system? What zip program do you want to use? How is the list of files specified? A text file? Can you provide a small example? Please edit and update the question with the answers. – DavidPostill Jul 14 '20 at 23:45
  • Question updated – Christian Townsend Jul 14 '20 at 23:51
  • Try 7z a -tzip archive.zip @listfile.txt – DavidPostill Jul 14 '20 at 23:56
0

@DavidPostill has a good answer. I am guessing each of your .csv files contains a list of filepaths like: D:\Resources\LabAutomationEmail\file1.ext D:\Resources\LabAutomationEmail\file2.ext ... If not, edit the .csv files so they look like that. Then use David's command line on each .csv file, replacing @listfile.txt with @C:\Resources\LabAutomationEmail\test.csv, etc.

You can even use wildcards if you are zipping all the files in particular directories. See: https://sevenzip.osdn.jp/chm/cmdline/syntax.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.