Kompx.com or Compmiscellanea.com

Renaming files in mc

Operating systems : Linux

Renaming a file in mc / Midnight Commander:

- Select a file --> Shift - F6 --> Edit existing file name into a new one --> Enter

Select a file

[ Image ] : mc - Select a file

Edit file name

[ Image ] : mc - Edit file name

The original way of renaming a file - the one mc / Midnight Commander had before "Shift - F6" was implemented - is also still there:

- Select a file --> F6 --> Enter a new file name --> Enter

Select a file

[ Image ] : mc - Select a file

Enter file name

[ Image ] : mc - Enter file name

And "Esc - 6" may be used instead of "F6":

- Select a file --> Esc - 6 --> Enter a new file name --> Enter

Select a file

[ Image ] : mc - Select a file

Enter file name

[ Image ] : mc - Enter file name

Aliosque subditos et thema

 

Imapsync IMAP migration under Windows

 

Migrating an IMAP e-mail box from one IMAP server to another under Windows [ 1 ] [ 2 ] by means of imapsync: Copying an e-mail box with all its contents and keeping its folder structure; The e-mail box is hosted at a web hosting company's server and transfered to a common Yandex Mail (not Yandex Mail for Domain); Both IMAP servers support SSL. The process is done in three steps: test run, migrating folder structure, migrating e-mails. Test run Content of imapsync-test.bat: .\imapsync.exe ^ --host1 imap.domain.ru --user1 email1@domain.ru --password1 "password1" ^ --host2 imap.yandex.ru --user2 email2@yandex.ru --password2 "password2" ^ --ssl1 --ssl2 --sslargs1 SSL_verify_mode=0 --sslargs2 SSL_verify_mode=1 ^ --skipheader "^(?!Message-Id)" ^ --automap ^ --regextrans2 "s/^INBOX\.(.+)/$1/" ^ --addheader ^ --justfolders ^ --dry @PAUSE Note: the caret character ( ^ ) at the end of line means "this command continues on the next line". It allows to break long command with many options into several parts to put them in several lines for better readability. This step is meant for testing if imapsync may be run at all, if it can connect to both e-mail boxes and can read the basic structure of the first one. Imapsync runs without actually doing anything, just printing what would have been done without the --dry option. Adding --justfolders is to make testing faster, as imapsync does its job only for folders then. A log file with full details for each run is placed into the LOG_imapsync folder. Migrating folder structure Content of imapsync-folders.bat: .\imapsync.exe ^ --host1 imap.domain.ru --user1 email1@domain.ru --password1 "password1" ^ --host2 imap.yandex.ru --user2 email2@yandex.ru --password2 "password2" ^ --ssl1 --ssl2 --sslargs1 SSL_verify_mode=0 --sslargs2 SSL_verify_mode=1 ^ --skipheader "^(?!Message-Id)" ^ --automap ^ --regextrans2 "s/^INBOX\.(.+)/$1/" ^ --addheader ^ --justfolders @PAUSE This step reproduces the folder structure of the e-mail box being migrated in the one it is being migrated to. Migrating e-mails Content of imapsync-emails.bat: .\imapsync.exe ^ --host1 imap.domain.ru --user1 email1@domain.ru --password1 "password1" ^ --host2 imap.yandex.ru --user2 email2@yandex.ru --password2 "password2" ^ --ssl1 --ssl2 --sslargs1 SSL_verify_mode=0 --sslargs2 SSL_verify_mode=1 ^ --skipheader "^(?!Message-Id)" ^ --automap ^ --regextrans2 "s/^INBOX\.(.+)/$1/" ^ --addheader @PAUSE Now e-mails are being copied.

Unzip multiple files. 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.