Search code examples
batch-filewinrar

Batch command with WinRar


I have a folder with name is 'MainFolder'. Inside this folder I have a lot folders and files. But inside 'MainFolder' I have one special folder (name of this folder is 'ABC'), with couple *.aspx files. Also in this folder I have a lot other folders with random names.

Question is: how I can make archive MainFolder.rar with all data, except ABC folder where will be just *.aspx files and not include sub-folders?


Solution

  • I'd do it in two steps, it should go something like this:

    rar a -r MainFolder.rar MainFolder -xABC
    rar a MainFolder.rar ABC -n.aspx
    

    Explanation: 1st command adds all but ABC folder (-r means recursive, -x means exclude). 2nd command adds aspx files from ABC folder to the same archive.


    UPDATED: -n seems to be the opposite of -x - does that do what you want?