Question

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?

Was it helpful?

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?

OTHER TIPS

You need first to build a list of the files to be included, using the FOR command. Read HELP FOR and try this simple code to get you started...

FOR %%a in (*.*) do (
  echo %%a >>%temp%\list.txt
)
FOR /d %%a in in (*.*) do (
  if /I NOT %%a==ABC (
    FOR %%b in (%%a\*.*) do (
      echo %%b >>%temp%\list.txt
  )
)

and then pass it to Winrar in the command line

rar a -r %temp%\files.rar @%temp%\list.txt
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top