Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Midnight Commander: panelize or select all files newer than specified date

    3rd February 2017

    If you ever need to select lots (hundreds, thousands) of files by their modification date, and your directory contains many more files (thousands, tens of thousands), then angel_il has the answer for you:

    1. touch -d “Jun 01 00:00 2011″ /tmp/.date1
    2. enter into your BIG dir
    3. press C-x ! (External panelize)
    4. add new command like a “find . -type f \( -newer /tmp/.date1 \) -print”

    I’ve used a slightly different approach, specifying desired date right in the command line of External Panelize:

    1. enter your directory with many files
    2. press C-x ! (External Panelize)
    3. add a command like find . -type f -newermt "2017-02-01 23:55:00" -print (man find for more details)

    In both cases, the created panel will only have files matching your search condition.

    Share

    Posted in *nix, Notepad | No Comments »

    Resume broken scp/mc/fish transfer with rsync

    17th October 2013

    Note: this is a draft post back from 2010. As it is still useful to me, I’ve decided to publish it as is.

    I had already mused on the powers of rsync before.

    This time, a reminder to self on how to resume copying broken scp/mc/fish transfers, using rsync.

    First, an assortment of example commands.
    export RSYNC_RSH=ssh
    rsync --partial file_to_transfer user@remotehost:/path/remote_file
    rsync -av --partial --progress --inplace SRC DST
    rsync --partial --progress --rsh=ssh host:/work/source.tar.bz2 .
    rsync --partial --progress --rsh=ssh -r me@host.com:/datafiles/ ./

    One could also try the --append option of rsync to base the transfer resumption on the sizes of the two files rather than verifying that their contents match.

    Now a single command line explained in a little more details:
    rsync -vrPtz -e ssh host:/remote_path/* /local_path/
    Explained:
    -e ssh rsync will use ssh client instead of rsh, which makes data exchange encrypted
    -z compress file transfer
    -t preserve time (other attributes, such as owner and permissions are also possible)
    -P resume incomplete file transfer
    -r recurse into subdirectories
    -v verbose

    To specify a port when using ssh you must add it to the ssh command.
    Example: rsync --partial --progress --rsh="ssh -p 16703" user@host:path

    Share

    Posted in Notepad | No Comments »

    Using FTP usernames with @-symbol in midnight commander

    7th May 2009

    MC is a console file manager. It supports FTP connections, and in my experience is faster in FTP than both Krusader and Gnome Commander.

    However, the default FTP connection format string [username[:password]@]hostname has a drawback of not allowing the use of usernames with ‘@’-symbol in them – which is very common for virtual hostings.

    One of the solutions is (done in your home directory):

    1. if there is no .netrc file in your home directory — touch .netrc && chmod 600 .netrc
    2. mcedit .netrc (or use vi, nano, or any other editor you prefer)
    3. add the following line to the file (replace all-caps words with your actual credentials): machine HOSTNAME login USER@HOSTNAME password PASSWORD

    Now, start MC, choose FTP connect, and enter only the hostname. You will be automatically logged in to the remote FTP.
    This will also work for console ftp clients like lftp.

    Share

    Posted in *nix, how-to | 1 Comment »