Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok first you need to have rar.exe in a folder in %PATH%, </p> <p>i'd suggest you put a link in your Windows\System32 folder like so:</p> <pre><code>mklink C:\Windows\System32\rar.exe "C:\Program Files\WinRAR\rar.exe" </code></pre> <p>then you can get to work.</p> <p>As you already suggested, first create the desired directory tree and then just add the required files to your archive like so: </p> <pre><code>rar.exe a %ARCHIVE_NAME% MainFolder\*.pdf rar.exe a %ARCHIVE_NAME% MainFolder\FolderA\* rar.exe a %ARCHIVE_NAME% MainFolder\FolderB\* </code></pre> <p>Whereas %ARCHIVE_NAME% is the file name of your <em>new</em> target archive (such as foo.rar)</p> <p>This will every *.pdf file in 'MainFolder' and everything in 'FolderA' and 'FolderB'. The directory tree <strong>will be preserved</strong>.</p> <p>Also, you may want to check whether %ARCHIVE_NAME% <strong>already exists</strong>, since rar will just add the specified files to an existing archive (possibly overriding them)</p> <p>Hope this clarifies some things for you.</p> <p><strong>Edit: doing this recursivly for unknown root directory</strong></p> <pre><code>set ARCHIVE_NAME=%CD%\pdf_archive.rar for /r %CD% %%d in ('PDF') do ( if exist "%%d" ( echo Archiving files in: %%d rar a "%ARCHIVE_NAME% "%%d"\* ) ) </code></pre> <p>Now this will go into <strong>every</strong> subdirectory recursivly (starting from your current directory)</p> <p>Then iw will look for folders called 'PDF' and if they exist it will archive <strong>every</strong> file in that folder to %ARCHIVE_NAME%</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload