Link to home
Start Free TrialLog in
Avatar of LeTay
LeTay

asked on

7zip exclude a list of directories (and their content)

I want to use an exclude file containing a list of directories to (recursively) exclude from a 7zip backup
The command  look like 7zip a .... -x@listfile
What is the syntax INSIDE the listfile ?
For example to exclude c:\blabla and d:\test ?
Thanks
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Try this - http://sourceforge.net/projects/sevenzip/forums/forum/45797/topic/3349845

For your example try
c:\blabla\*
d:\test\*


now I use a excellent workaround for all the cases:

    *subdirname*

for all the lines.

and if i have some extensions that i don't want ONLY in some subdirs i use:

    *someofthesubdirtext*.extension

For **example**, i can create an exclude_file.txt to be used with an -xr@excludefile.txt switch, containing for example:

    *local\adobe*
    *local\Microsoft*
    *roaming\Microsoft*
    *temporary internet*
    *temp\*.exe

... and this for sure works GREAT. In the above example i excluded three of the main space-consuming directories in a typical backup of a Vista user profile (obviously no Win.Mail backup was performed) , IE temporary internet files (all), and all the exe files found in typical temp directory...
Avatar of LeTay
LeTay

ASKER

I have done something like this : 7z a .... -x@c:\exclude.lst

The c:\exluce.lst contains one line (test)   c:\mydir\*

But that directory is taken and zipped !
Try c:\mydir\*.*

Avatar of LeTay

ASKER

Same result
Is a kind of "recursive" info not missing somewhere ?
So files from that folder still end up in the archive or is it just and empty directory?

If files are being archived try wildcardng some of them to see if that's working for you.


Maybe try c:\mydir\*.txt

Avatar of LeTay

ASKER

All the files are included, absolutely all !
I tried also at command line -xr@ ... instead of -x@ .... same
Is it actually executing your list file? Maybe try the complet path or runing from the same directory as the list file.
Avatar of LeTay

ASKER

Very strange even specifying c:\midir\*.txt is taking the .txt files
Avatar of LeTay

ASKER

Yes, I put the complete path for the directory
Here the syntax I used

"c:\program files\7-Zip\7z.exe" a -r -mx1 -y -tzip -xr@c:\data\bat\exclude.lst c:\data\bat\save.zip @c:\data\bat\include.lst
ASKER CERTIFIED SOLUTION
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
its works fine thanks, but i dont want files to be left out in the folder after archiving and only the exclude list files should be there. can you pls give me a solution for this?
thanks in advance
it was very useful info in this URL