FTP-UPLOAD(1p)
π FTP-UPLOAD(1p) π
okay bestie so this is ftp-upload, from the User Contributed Perl Documentation (section 1p), and it's genuinely one of those little tools that just works if you let it. sit down, grab a strawberry, we're doing this together π
β¨ NAME β¨
ftp-upload β batch transfer local files to an FTP server π¦
πΈ SYNOPSIS πΈ
ftp-upload [any-switch]... {[repeatable-switch]... file...}...
π DESCRIPTION π
so ftp-upload sends your local files to an FTP server. that's it, that's the whole vibe. π
it is not interactive β it's built to live inside scripts, which honestly is its main character era. it's super disciplined about its exit value (like, it will not play games with you about whether it succeeded), and by default it doesn't print informational messages at all. silent, mysterious, iconic. π
now, there are two kinds of switches, and this is the part where people get confused so pay attention bestie:
- Initial switches β these have to come before any filenames. they affect the whole session as one big thing.
- Repeatable switches β these can be sprinkled in between the file names. they affect the transfer of whatever files come after them on the command line.
π OPTIONS π
π Initial switches
these have to be used before any file names listed on the command line. no negotiating. π
--debugβ turn debugging on. π--helpβ show the usage message and die. dramatic, but make it helpful.--ignore-quit-failureβ don't complain and don't set a failure exit code just because theQUITcommand fails. why would you ever need this? because some servers, in blatant disregard of RFC 959, close the command channel the moment you send them anABORcommand. rude behavior, honestly. π-v,--verboseβ print informational messages tostdout. the opposite of its default introvert energy.--versionβ show the version number and exit. quick lil flex. β¨
π¦ Initial switches which specify connection information
these also have to be used before any file names on the command line. they're the ones that describe how the FTP connection itself gets set up. π
--accountaccount β the account to use when logging into the remote system. this is distinct from the user name used to log in. few systems actually need it. there is no default.-h,--hosthost β the host to connect to. there is no default, so likeβ¦ you have to pass this switch. it's not optional, bestie, it's the whole point. π--passiveβ force the use of passive (PASV) transfers. passive transfers are required with some firewall configurations, but if you're in that situation you'd honestly do better configuringNet::FTPso it knows when to use them (seeNet::Config). however, if you need passive transfers with certain (broken) servers, this switch is your best bet. alternatively you can set$FTP_PASSIVEto1in the environment (seeNet::FTP).--no-passiveβ force active mode transfers. active mode is the default, so you only need this if yourNet::Configor$FTP_PASSIVEturned passive mode on.--passwordpw β the password used to login. the default is your email address.
β οΈ do NOT put a real (secret) password here. on most systems, anybody on the machine can see the arguments you pass to your commands. use one of the other password-setting switches instead. i'm begging you. π
-s,--password-stdinβ read the password from standard input. no prompt gets printed, and a single line is read. most people use this switch for the password, and honestly, slay. eg,
echo 3x9sjJJh | ftp-upload -sh $host -u $user $file
using echo this way is safe where --password isn't β as long as the echo command is built in to the shell. π
--password-fdfd β like--password-stdin, except it reads the password from the file descriptor numbered fd.
ftp-upload -h $host -u $user --password-fd=3 3<$pw_file $file
-u,--useruser β the user name to use when logging in. the default is"anonymous". β¨
π Repeatable switches
these can be used anywhere on the command line (except after the last file name, obviously π). they affect the transfer of the files listed after them.
--asremote-name β normally a file gets transferred using the same name it has locally. use this switch and the next file transferred will be called remote-name on the other host instead.
ftp-upload --host $host --as index.htm index.html
-a,--asciiβ do the transfers in ASCII mode.-b,--binaryβ do the transfers in binary mode. this is the default. π₯-d,--dirdir β change directory to dir on the FTP server before continuing. you can use this multiple times between files, andftp-uploadwill chdir once for each time you specify it. using".."as the dir causes an FTP"CDUP"to be done instead of a"CWD". ποΈ--full-pathβ normally uploaded files go into the current directory on the remote host, even when the local file name you gave contains slashes. eg, if you say
ftp-upload -h $host /etc/motd
ftp-upload will upload the file as motd, not /etc/motd. this differs from how the standard ftp program works, and it also differs from how ftp-upload worked before version 1.3. if you specify --full-path, you get the other behavior. a request to upload dir/file tells the server to store dir/file rather than file. when you use --as, the --full-path setting doesn't matter. --full-path only tells the program what name to use when it's choosing the name.
--no-full-pathβ disable--full-path. this is the default.-l,--lsβ try to get a remote directory listing of the files after transferring them. i say "try" because there is no guaranteed way to do this with the FTP protocol. the command it runs is"LIST file". this will generally work if file doesn't contain any special characters.-L,--no-lsβ disable the--lsbehavior.--tmp-noneβ transfer files directly, don't do anything special to try to keep them from appearing under their real names on the remote machine until the transfer is finished. each file is transferred with a single simple"STOR". this is the default.--tmp-samedirβ transfer files to the remote machine using a temporary name, then rename them when the transfer finishes. this won't work if the remote server doesn't give a recognizable response to the"STOU"command. π¬ if the server's response to"STOU"isn't recognized byNet::FTPbut is reasonable, Graham Barr might be willing to changeNet::FTPto recognize it. if you like, you can send the--debugoutput to the author and he'll coordinate such requests. π€--tmp-dirdir β transfer files to dir on the remote host, then rename them when the transfer is complete. this is safer than--tmp-samedirbecause it doesn't use"STOU", and so it works with more servers.
ftp-upload -h $host --tmp-dir incoming $file
--tmp-formatfmt β transfer files tosprintf(fmt, file base name), then rename them when the transfer is complete. like--tmp-dir, this is safer than--tmp-samedirbecause it doesn't use"STOU", so it works with more servers.
ftp-upload -h $host --tmp-format tmp.%s $file
π AUTHOR π
Roderick Schertler <roderick@argon.org> β absolute legend, we stan. π«Ά
okay that's the whole page, bestie, you're officially fluent π this one's from perl v5.36.0, dated 2022-11-21, so go forth and upload responsibly, and please don't put your real password on the command line. mwah π β¨
π¦ where this page comes from
- debian bookworm: ftp-upload 1.6-4 Β· GPL-2.0-or-later
- debian trixie: ftp-upload 1.6-4 Β· GPL-2.0-or-later
- ubuntu noble: ftp-upload 1.6-4 Β· GPL-2.0-or-later
- ubuntu questing: ftp-upload 1.6-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms