?
Solved

Batch FIle: 7ZIP

Posted on 2010-08-16
5
Medium Priority
?
885 Views
Last Modified: 2012-08-14
Hi there,

I need to use 7Zip to sequently add & compress files by keeping their full path.

Output compression must have highest compression rate and if it gets greater than 2GB, must create a new file with a sequential number:

For example:
has-been_01.zip
has-been_02.zip


@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%A in ('dir /s /b .\Documents') do (
  7z.exe ...
  )


Thanks for your help,
Rene
0
Comment
Question by:ReneGe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 56

Assisted Solution

by:Bill Prew
Bill Prew earned 400 total points
ID: 33450839
I don't think you are going to be able to do this with 7Z. I'm not aware of any way to add a single file with it's complete path.  Paths only get stored with wild cards and recursive mode, but that would add all the files at once, and not check the 7z output file size after each file.  You'll probably;y have to look at more robust tools like WinZip or WinRar for these types of advanced capabilities.

~bp
0
 
LVL 4

Accepted Solution

by:
BasiKobrA earned 1600 total points
ID: 33452324
Hey,
As billprew told you, 7zip does not support 'absolute path'.

Citing the FAQ at http://www.7-zip.org/faq.html:
How can I store full path of file in archive?
7-Zip stores only relative paths of files (without drive letter prefix). You can change current folder to folder that is common for all files that you want to compress and then you can use relative paths:
  cd /D C:\dir1\
  7z.exe a c:\a.7z file1.txt dir2\file2.txt

So if you want to use 7zip, you could go to the combined top level directory and zip everything from there. But at extraction time, you'd need to be in the same combined top directory...


For the splitting in 2gig blocks, you can add the switch '-v2g'
Cite man page:
v{Size}[b|k|m|g]
Create volumes


For the example you gave, that would be:
7z.exe a -r -v2g -mx=9 yourArchive.7z Documents
0
 
LVL 10

Author Comment

by:ReneGe
ID: 33454114
==> billprew
Thanks for your contribution.  I see that my "keeping their full path" requirement was not possible.

==> BasiKobrA,
Your comand line works. I will then do as you suggested. Create the archive within the full path, containing the compressed file.

************************************************************************

1) Would it be possible to the archive keep NTFS security and Audit settings. If not please advise.
2) How do I add the option of excluting files, by using a text file that will contain the exclusion parameters.  (-x...) (exclude.ini contains: *.mp3, *.wav, *.avi)

Thanks,
Rene
0
 
LVL 10

Author Comment

by:ReneGe
ID: 33454336
I'll create 2 new threads for my 2 previous questions, so you can make more points.
I will prove you with the links when done.

Cheers,
Rene
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question