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
    Commented Jul 14, 2020 at 23:45
  • Question updated Commented Jul 14, 2020 at 23:51
  • Try 7z a -tzip archive.zip @listfile.txt
    – DavidPostill
    Commented Jul 14, 2020 at 23:56

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .