Trasferire file via ZModem

Tra le operazioni di base più utili per una macchina connessa ad una rete, è fondamentale poter trasferire in ingresso ed uscita dei file. ZModem è un protocollo utilizzato per la sua semplicità e flessibilità per trasferimenti veloci all’interno di sessioni SSH.

Trasferire file via ZModem

ZModem

Emerso negli anni 80 come protocollo di trasferimento di file, ZModem è il risultato di miglioramenti a tecniche preesistenti. La diffusione è stata tale nel mondo delle BBS che praticamente ancora oggi le implementazioni software sono esistenti per la maggior parte delle piattaforme, da DSZ a lrzsz.

Proprio quest’ultimo è praticamente un pacchetto ubiquo e disponibile per tutti i sistemi Unix, Linux e derivati.

Installare ZModem in Linux

Di seguito l’installazione e i repository disponibili per le distribuzioni Linux più comuni:

Debian, Ubuntu

apt-get install lrzsz

RedHat, CentOS

yum -y install lrzsz

Usare ZModem in MacOSX

In MacOSX ZModem è disponibile come formula Homebrew installabile con il comando

brew install lrzsz

In caso di utilizzo in abbinamento con iTerm2, è necessario creare degli script da lanciare e configurare tra i trigger, attivandoli con le sintassi in espressione regolare intercettando l’output restituito rispettivamente da rz e sz.

Codice dal repository Github

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required 
# Remainder of script public domain

FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
if [[ $FILE = "" ]]; then
	echo Cancelled.
	# Send ZModem cancel
	echo -e \\x18\\x18\\x18\\x18\\x18
	echo \# Cancelled transfer
	echo
else
	echo $FILE
	cd "$FILE"
	/usr/local/bin/rz 
	echo \# Received $FILE
	echo
fi
#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required 
# Remainder of script public domain

FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
if [[ $FILE = "" ]]; then
	echo Cancelled.
	# Send ZModem cancel
	echo -e \\x18\\x18\\x18\\x18\\x18
	echo \# Cancelled transfer
	echo
else
	echo $FILE
	/usr/local/bin/sz "$FILE"
	echo \# Received $FILE
	echo
fi

13 commenti su “Trasferire file via ZModem”

  1. Hello I am so delighted I found your webpage, I really found you by error, while I was researching on Aol for something else, Nonetheless I am here now
    and would just like to say thank you for a incredible post
    and a all round thrilling blog (I also love the
    theme/design), I don’t have time to read through it all at
    the moment but I have bookmarked it and also added your RSS feeds, so when I have time I will
    be back to read much more, Please do keep up the awesome jo.

  2. It’s amazing designed for me to have a site, which is helpful for my
    experience. thanks admin

  3. Hi! This is my 1st comment here so I just wanted to
    give a quick shout out and tell you I really enjoy
    reading your blog posts. Can you suggest any other blogs/websites/forums that
    cover the same subjects? Thank you!

  4. è da una settimana cһe navigo e questo post è la prima cosa interessantе che leggo.
    Davvero appassionante. Se tutte lee perssone che creano
    siti web facessero attenzione dі offrire matᥱriale attraente come questo
    la rete sarebbe sicuramᥱnte più utile. Grazie!

  5. Hello it’s me, I am also visiting this site on a regular basis, this
    web site is truly fastidious and the people are genuinely sharing nice thoughts.

  6. It’s an remarkable piece of writing in favor of all the web
    people; they will obtain benefit from it I am sure.

  7. Simply desire to say your article is as astonishing. The clarity on your submit is simply great and that i could think you are a professional on this subject.
    Well with your permission let me to seize your feed to
    stay up to date with approaching post. Thanks a million and please continue the enjoyable work.

  8. è daa unaa settimana сhe navigo е il tuo sito è l’unica cosa
    brillante che trovo. Realmente apprezzabile. Se tutte le persone che
    creano post badasssero a offrire matriaⅼe aρpassionante
    come questo iil web ѕarebbe certamente ρiù faⅽile
    da leggеre. Grazie!

  9. Hey just wanted to give you a quick heads up and let you know a few
    of the pictures aren’t loading properly. I’m not sure why
    but I think its a linking issue. I’ve tried it in two different browsers and both
    show the same results.

  10. You’re so cool! I do not suppose I have read through
    a single thing like that before. So nice to discover
    someone with some unique thoughts on this subject matter.
    Really.. thanks for starting this up. This website
    is one thing that is required on the web, someone with a little originality!

  11. I feel this is one of the most important info for me. And i’m happy reading your article.
    But wanna remark on some normal things, The site taste is
    wonderful, the articles is actually excellent : D. Just right
    activity, cheers

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.