Blog How to...Read more

B1-consol-blog

How to use B1 from console (command line interface)

February 24, 2014

Not only does B1 has great visual interface, it also supports working from console.

 

B1 manager command line can be used in 2 forms:
 
1) Simple form:
b1arc <archive_name> – these should open archive in main view.

 

2) Common form:
b1arc <command> [command_option] <archive_name> < [<dst_folder>] | [<file_names> ...] | [<@listfile>] >

 

<comands>

   a: Add items to archive
   x: Extract items
    l: List items (only console version)

 

[command_option] – is used to specify target format (for archive command), encoding code page (for extract command, ZIP archive only), password (extract and archive commands) and force flag (only console version). By default, target archive format is b1 and code page is system code page.
 

    -t<b1|zip>
    -enc=<code page>
    -pass=<password>
    -f (if you want to run b1 in silent mode)

 

<archive_name> – path to archive, can be in 3 forms:
 

    1) /full/path/archive.name   or   relative/path/archive.name
    2) *proposed_archive.name
    3) @archives_list_file.txt with new-line-separated archives pathes
       This form is used for internal purposes, for archiving. It asks B1 to show archive 
 options dialog. "proposed_archive.name"(without path) will be default name in this dialog 
 (name of the first item, or parent catalog would be nice).

 

<dst_folder> – destination folder for extraction (full or relative), can be in 2 forms (like <archive_name>):

    1) /full/path  or   relative/path  - silent extract to selected folder
    2) */full/path - show window "Select folder" with initial folder "/full/path".

 

<file_names> – space separated paths to files (in case path to file contain spaces it should be quoted, for ex.: “c:/program files/11.txt”)

 

<@listfile> – path to list file prefixed by @.

 List file should contain list of items (files or folders) which should be added to archive.
 One item per line. On Windows the file should use utf16 encoding, on Linux - utf8. Preferred 
 location for this file - %TEMP% folder.

 

Example usage:
 

 1)b1arc a aaa.b1 1.txt /home/2.txt 3.txt
 2)b1arc a -tzip aaa.zip @/temp/files.lst, where context of files.lst:
    1.txt 
    /home/2.txt 
    3.txt
 3)b1arc a -tzip "*aaa.zip" "@/temp/files.lst" - "archive options window" will be launched
 with def name established to aaa.zip

4)b1arc x -enc=utf-8 arc.zip /home/aaa/
5)b1arc x -enc=cp866 arc.zip /home/aaa/
6)b1arc x aaa.zip /home/aaa/
7)b1arc l aaa.zip
(list archive aaa.zip)
8)b1arc l -pass=MyFaVoRiTePassWord aaa.zip
(list encrypted archive aaa.zip)
9)b1arc x -pass=MyFaVoRiTePassWord aaa.zip /home/bbb/
(extract encrypted archive aaa.zip to folder "/home/bbb/")
 

B1 should be launched with work directory established to selected item location.