|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
Utility lftp provides the ability to run commands from the file and as such is the best for scripting ftp sessions.
Netdrive and similar FTP filesystems allow using regular commands to send and retrieve files from remote server. Windows 7 supports FTP filesystem nativly.
BTW regular, "classic" ftp client is also scriptable via I/O redirection.
|
Switchboard | ||||
Latest | |||||
Past week | |||||
Past month |
|
April 27, 2005 | nixCraft
by nixCraft on April 27, 2005 · 8 comments· LAST UPDATED October 28, 2012
When you host your web site remotely and and the ftp server is the only way to upload all files including subdirectroies. You need to use special file transfer program such as ncftpget or ncftpput for recursive remote ftp server uploading and downloading purpose. Ncftp is considered as an improved FTP client. Ncftp's improvements include support for command line editing, command histories, recursive gets/puts, automatic anonymous logins, and much more.
... ... ...
The syntax is as follows:
ncftpput ftp-host-name /path/to/remote/dir /path/to/local/dir ncftpput -options ftp-host-name /path/to/remote/dir /path/to/local/dirTry the ncftpput client command as follows:
ncftpput -R -v -u "username" ftp.nixcraft.biz /nixcraft/forum /tmp/phpbbWhere,
- -u "username" : Ftp server username
- -v : Verbose i.e. show upload progress
- -R : Recursive mode; copy whole directory trees.
- ftp.nixcraft.biz : Remote ftp server (use FQDN or IP).
- /nixcraft/forum : Remote ftp server directory where all files and subdirectories will be uploaded.
- /tmp/phpbb : Local directory (or list of files) to upload remote ftp server directory /nixcraft/forum
You can pass the password with -p option:
ncftpput -R -v -u "username" -p "passwordHere" ftp.nixcraft.biz /nixcraft/forum /tmp/phpbbYou can use port number 2021 instead of the default FTP service port # 21 as follows:
ncftpput -R -v -u "username" -p "passwordHere" -P 2021 ftp.nixcraft.biz /nixcraft/forum /tmp/phpbbSee also
- See ftptreeupload.bash script to copy all files and subdirectories recursively and upload them to remote FTP server (copy local all directories/tree to remote ftp server).
- ncftpput client can be downloaded from http://www.ncftp.com/ncftp/ and works with FreeBSD, Solaris and all most all UNIX like variant.
|
Manually transferring a file or files via FTP is a common and convenient method for moving data from one computer to another, especially if it's a non-recurring event. But the reality is there are many times when an event is recurring and calls for immediate automation. This can be done by using a simple UNIX script file, which can then be executed via command line interface or added to the crontab. In the example below, I'm FTP'ing binary type files (pictures) from a local computer to a remote while logging the activity.
Note: Some organizational policies may not allow login/password information in a script file.
# vi myftp.sh #! /bin/sh REMOTE='esoft' USER='anyuser' PASSWORD='myftp125' FTPLOG='/tmp/ftplog' date >> $FTPLOGftp -n $REMOTE <<_FTP>>
Run via CLI
# ./myftp.sh
Add it to the crontab
# crontab -e
Re: Unix scripts to interact with Windows NT
Author:
SolBetaTester_1
Nov 12, 2004 11:47 AM (reply 5 of 7)
Some things to consider when running "Services for Unix" SFU:
-Downloading the package is around 250 Mb.
-SoftMikky does not allow download resume.
(this can be quite a problem if you download with a 56k modem or alike)
-Besides C, Korn shell & FTP server, SFU is also NSF client & server, PCNFS server,
Telnet client & server, NIS server.
-Users have to be set up or synchronised.
Possible, but all a bit much preparation for a small java app to run on every NT machine.
Re: Unix scripts to interact with Windows NT
Author: jonnys3
Feb 15, 2005 8:25 AM (reply 6 of 7) Sounds like your working in a mixed O/S environment.
From my experience it is probably easier for you to set the job running from NT and have your NT box ftp to your Solaris box, get the JAVA file, run the JAVA file and have the NT box ftp the results back to the Solaris box. This is very easy to configure:
Create a simple text file called ftp.txt in c:\ on your NT box. Add the following lines:
ftpaccount
P4s5W0rD
lcd c:\where\you\want\the\JAVA\file\to\run\from
hash
bin
cd /dir/with/JAVA/file/in/it
get JAVAfile
close
bye
Save this text file.
The first line is the UNIX account you will be logging into on the Solaris box;
The second line is the password for the UNIX account;
The third line switches to the local directory on your NT box where you want the
JAVA file to sit;
The fourth line tells ftp to turn on hash marking; the fifth line tells ftp to transfer
files in binary mode;
The sixth line changes to the directory in which your JAVA file is held;
The seventh line gets the JAVA file (replace JAVAfile with the name of the file)
The eight line closes the connection to the Solaris box;
The ninth line ends the ftp utility on NT.
Create a second txt file called ftp2.txt and add the following commands:
ftpaccount
P4s5W0rD
lcd c:\where\the\results\file\sits
hash
bin
cd /dir/where/results/file/needs/to/be/put
put resultfilename
close
bye
The first line is the UNIX account you will be logging into on the Solaris box;
The second line is the password for the UNIX account;
The third line switches to the local directory on your NT box where the JAVA result file sits;
The fourth line tells ftp to turn on hash marking; the fifth line tells ftp to transfer files in binary mode;
The sixth line changes to the directory on the Solaris box in which you want your results file to sit;
The seventh line puts the results file on the Solaris box;
The eight line closes the connection to the Solaris box;
The ninth line ends the ftp utility on NT.
Now create a bat file to run the ftp-scripts and execute the JAVA file ie ftp.bat.
Add the following lines:
ftp -i -s:"c:\ftp.txt" 10.1.18.208:
<next line needs to be the DOS command to run the java file on NT ie c:\Temp\DMS0104\jinit11819.exe
-s -m>
ftp -i -s:"c:\ftp2.txt" 10.1.18.208:
where 10.1.18.208 is the ip address of the Solaris box
whenever you need to run the script at the command prompt run c:\ftp.bat, or you can schedule it to run using the "at" command.
If I haven'e explained this very clearly look in BigAdmin scripts or search the net as there are hundreds of examples of ftp scripts.
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March 12, 2019