Kompx.com or Compmiscellanea.com

Unzip multiple files. Linux

Operating systems : Linux

Unzip multiple zip files into one directory by Linux command line unzip. Contrary to possible expectations, "unzip *.zip" is not going to work, *.zip should be put into quotes:

unzip "*.zip"

There may be files with the same names in these archives. To avoid overwriting:

unzip -B "*.zip"

"Unzip -B" makes unzip to overwrite duplicates during extraction process, but saving a backup copy of each overwritten file. The names for these backup copy files are created by adding tilde ("~") at the end of the original names of the files. If a file extension is present, then "~" is added after it. If that is not enough, unique sequence number (up to 5 digits) is appended after the "~".

"Unzip -B" is not too practical. For example, since when the sequence number range for numbered backup files gets exhausted (99999, or 65535 for 16-bit systems), the backup file with the maximum sequence number is deleted and replaced by the new backup version without notice ( More on the subject ). The number of files in an archive may not be always known in advance or may be more than possible sequence number range, so "Unzip -B" is not a great choice. Renaming duplicate files by adding "~" at the end of their names, after the extension, is not too convenient either.

But another built-in option is even worse. If the "-B" modifier is not used, each time a file with same name as there already unpacked is being extracted, unzip asks "replace example.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename:". And each time "r" must be hit, then a new name has to be input. So some bash or another script solving the problem should probably be prepared and used instead.


Aliosque subditos et thema

 

Imapsync. IMAP migration

 

Migrating an IMAP account from one IMAP server to another [ 1 ] / Linux, command line: imapsync --host1 imap.this.com --user1 email@example.com --passfile1 /home/user/imap/passwordfile1 --ssl1 --host2 imap.another.com --user2 email@example.com --passfile2 /home/user/imap/passwordfile2 --ssl2 --skipsize --allowsizemismatch - There is a web site (example.com) and an email box (email@example.com) hosted at a web hosting company. The IMAP server: imap.this.com. The IMAP server supports SSL. - The example.com web site is to be transfered to another web hosting company. So is the email@example.com box with all its contents and keeping its folders structure. The IMAP server of another web hosting company: imap.another.com. The IMAP server supports SSL. 1. Set up an email box named email@example.com and a password to it on the server of the web hosting company the email@example.com mailbox is to be transfered to - from the previous web hosting company. 2. Create two text files in /home/user/imap/: passwordfile1 with the password for the mailbox on the first IMAP server and passwordfile2 with the password for the mailbox on the second IMAP server. 3. chmod 600 /home/user/imap/passwordfile1 4. chmod 600 /home/user/imap/passwordfile2 5. Install imapsync 6. Run imapsync Imapsync transfers a mailbox - keeping its folders structure - from imap.this.com to imap.another.com. SSL is used to enable encryption and passwords are saved to protected files (chmod 600). Migration between two email service boxes may happen to require to make use of more imapsync options [ 2 ]. Like transfering contents of one Gmail.com box to another demands to have "--port1" and "--port2" specified: imapsync --host1 imap.gmail.com --port1 993 --user1 email1@gmail.com --passfile1 /home/user/imap/passwordfile1 --ssl1 --host2 imap.gmail.com --port2 993 --user2 email2@gmail.com --passfile2 /home/user/imap/passwordfile2 --ssl2 --skipsize --allowsizemismatch [ 1 ] A simple and common case: contents of one email box are transfered to another, empty mailbox. But there can be more complicated ones like: Gmail to Google Apps Email Migration and Moving to Google Apps with imapsync. [ 2 ] For more command options: Migrate mail from one server to another with imapsync and imapsync(1) - Linux man page.

CSS horizontal and vertical centering - 1

 

Centering the content of a web page in the viewable area of a browser by means of CSS. A box to contain the whole content of the page is CSS centered horizontally and vertically: [ Open demo page ] HTML / XHTML. Code: <!DOCTYPE html> <html> <head> <title>CSS horizontal and vertical centering - 1</title> <link rel="stylesheet" type="text/css" href="css.css" /> </head> <body> <div class="all"> <div class="wrapper"> <div class="pagecontent">&nbsp;</div> </div> </div> </body> </html> CSS. Code: html {height: 100%; margin: 0px;} body height: 100%; margin: 0px;} .all {position: relative; left: 0px; top: 0px; height: 100%; width: 100%; float: left; display: table;} .wrapper {position: relative; left: 0px; top: 0px; height: auto; width: 100%; display: table-cell; vertical-align: middle;} .pagecontent {position: relative; left: 0px; top: 0px; height: 500px; width: 800px; margin: 0 auto; background: #ff6f6f;} The .pagecontent box is for the page content. It may be of height assigned explicitly or just "height: auto". Unlike CSS horizontal and vertical centering - 2, here percents may also be used as CSS units; not just px's or em's. Height and width may be larger than web browser viewable area, but here the more practical case is discussed - when the height and width of .pagecontent are smaller than those of the web browser viewable area. The .pagecontent box is horizontally centered by its "margin: 0 auto". .All with its CSS properties makes the whole web browser viewable area into a CSS table. CSS properties makes .wrapper into the cell of this CSS table. The content of this CSS table cell - the .pagecontent box with everything inside it - is vertically centered in the viewable area of a browser by "vertical-align: middle". [ 1 ] As well as Netscape 7.2+, Mozilla 1.5+. [ 2 ] As well as Netscape 7.2+, Mozilla 1.5+.