none
WinRAR pelo Prompt de Comando - Compactar apenas o arquivo sem os diretórios originais. RRS feed

  • Pergunta

  • Olá,

    Utilizei o comando abaixo:

    cd c:\arquiv~1\winrar
    rar a "C:\Pasta\Subpasta\Subpasta\Arquivo.rar" "C:\Pasta\Subpasta\Subpasta\Arquivo.txt"

    E na descompactação o arquivo ficou dentro de todas as subpastas originais. Existe uma maneira de compactar apenas o arquivo sem os diretórios?

    sábado, 29 de agosto de 2015 21:56

Respostas

  • Ola Itamar,

    sim é possivel, mas você deverá baixar o winrar por command line, baixe o UnRAR for Windows no link http://www.rarlab.com/rar_add.htm link direto download.

    UnRAR.exe e  -y -kb "C:\Pasta\Subpasta\Subpasta\Arquivo.rar"  "C:\Pasta\Subpasta\Destino"

    Essa opção, só descompacta arquivos txt

    UnRAR.exe e -y -kb UnRAR.exe e -y -kb "C:\Pasta\Subpasta\Subpasta\Arquivo.rar" *\*.txt "C:\Pasta\Subpasta\Destino"

    Usage:     unrar <command> -<switch 1> -<switch N> <archive> <files...>
                   <@listfiles...> <path_to_extract\>

    <Commands>
      e             Extract files to current directory
      l[t,b]        List archive [technical, bare]
      p             Print file to stdout
      t             Test archive files
      v[t,b]        Verbosely list archive [technical,bare]
      x             Extract files with full path

    <Switches>
      -             Stop switches scanning
      @[+]          Disable [enable] file lists
      ac            Clear Archive attribute after compression or extraction
      ad            Append archive name to destination path
      ag[format]    Generate archive name using the current date
      ai            Ignore file attributes
      ap<path>      Set path inside archive
      av-           Disable authenticity verification check
      c-            Disable comments show
      cfg-          Disable read configuration
      cl            Convert names to lower case
      cu            Convert names to upper case
      dh            Open shared files
      ep            Exclude paths from names
      ep3           Expand paths to full including the drive letter
      f             Freshen files
      id[c,d,p,q]   Disable messages
      ierr          Send all messages to stderr
      inul          Disable all messages
      ioff          Turn PC off after completing an operation
      kb            Keep broken extracted files
      n<file>       Include only specified file
      n@            Read file names to include from stdin
      n@<list>      Include files listed in specified list file
      o[+|-]        Set the overwrite mode
      oc            Set NTFS Compressed attribute
      or            Rename files automatically
      ow            Save or restore file owner and group
      p[password]   Set password
      p-            Do not query password
      r             Recurse subdirectories
      ri<P>[:<S>]   Set priority (0-default,1-min..15-max) and sleep time in ms
      sl<size>      Process files with size less than specified
      sm<size>      Process files with size more than specified
      ta<date>      Process files modified after <date> in YYYYMMDDHHMMSS format
      tb<date>      Process files modified before <date> in YYYYMMDDHHMMSS format
      tn<time>      Process files newer than <time>
      to<time>      Process files older than <time>
      ts<m,c,a>[N]  Save or restore file time (modification, creation, access)
      u             Update files
      v             List all volumes
      ver[n]        File version control
      vp            Pause before each volume
      x<file>       Exclude specified file
      x@            Read file names to exclude from stdin
      x@<list>      Exclude files listed in specified list file
      y             Assume Yes on all queries


    att, Aparecido Deveza


    terça-feira, 29 de setembro de 2015 21:18

Todas as Respostas

  • Ola Itamar,

    sim é possivel, mas você deverá baixar o winrar por command line, baixe o UnRAR for Windows no link http://www.rarlab.com/rar_add.htm link direto download.

    UnRAR.exe e  -y -kb "C:\Pasta\Subpasta\Subpasta\Arquivo.rar"  "C:\Pasta\Subpasta\Destino"

    Essa opção, só descompacta arquivos txt

    UnRAR.exe e -y -kb UnRAR.exe e -y -kb "C:\Pasta\Subpasta\Subpasta\Arquivo.rar" *\*.txt "C:\Pasta\Subpasta\Destino"

    Usage:     unrar <command> -<switch 1> -<switch N> <archive> <files...>
                   <@listfiles...> <path_to_extract\>

    <Commands>
      e             Extract files to current directory
      l[t,b]        List archive [technical, bare]
      p             Print file to stdout
      t             Test archive files
      v[t,b]        Verbosely list archive [technical,bare]
      x             Extract files with full path

    <Switches>
      -             Stop switches scanning
      @[+]          Disable [enable] file lists
      ac            Clear Archive attribute after compression or extraction
      ad            Append archive name to destination path
      ag[format]    Generate archive name using the current date
      ai            Ignore file attributes
      ap<path>      Set path inside archive
      av-           Disable authenticity verification check
      c-            Disable comments show
      cfg-          Disable read configuration
      cl            Convert names to lower case
      cu            Convert names to upper case
      dh            Open shared files
      ep            Exclude paths from names
      ep3           Expand paths to full including the drive letter
      f             Freshen files
      id[c,d,p,q]   Disable messages
      ierr          Send all messages to stderr
      inul          Disable all messages
      ioff          Turn PC off after completing an operation
      kb            Keep broken extracted files
      n<file>       Include only specified file
      n@            Read file names to include from stdin
      n@<list>      Include files listed in specified list file
      o[+|-]        Set the overwrite mode
      oc            Set NTFS Compressed attribute
      or            Rename files automatically
      ow            Save or restore file owner and group
      p[password]   Set password
      p-            Do not query password
      r             Recurse subdirectories
      ri<P>[:<S>]   Set priority (0-default,1-min..15-max) and sleep time in ms
      sl<size>      Process files with size less than specified
      sm<size>      Process files with size more than specified
      ta<date>      Process files modified after <date> in YYYYMMDDHHMMSS format
      tb<date>      Process files modified before <date> in YYYYMMDDHHMMSS format
      tn<time>      Process files newer than <time>
      to<time>      Process files older than <time>
      ts<m,c,a>[N]  Save or restore file time (modification, creation, access)
      u             Update files
      v             List all volumes
      ver[n]        File version control
      vp            Pause before each volume
      x<file>       Exclude specified file
      x@            Read file names to exclude from stdin
      x@<list>      Exclude files listed in specified list file
      y             Assume Yes on all queries


    att, Aparecido Deveza


    terça-feira, 29 de setembro de 2015 21:18
  • Olá Aparecido!

    Obrigado pela ajuda, eu já havia desistido disso e fiquei compactando manualmente, mas com a sua resposta, mesmo passado tanto tempo, resolvi o meu problema agora.

    Valeu!

    quinta-feira, 12 de janeiro de 2017 18:01
  • Sei que o tópico é antigo, mas como me bati para resolver a mesma questão quero deixar aqui a resposta pra outras pessoas que estiverem buscando a mesma coisa:

    no caso do amigo acima era só acrescentar o parâmetro: -ep

    ficaria assim dai no caso: 

    rar a -ep "C:\Pasta\Subpasta\Subpasta\Arquivo.rar" "C:\Pasta\Subpasta\Subpasta\Arquivo.txt"

    sexta-feira, 5 de junho de 2020 21:03