How would you use mput to FTP files from the Mac Terminal? |
|||||
Just a quick background before we start this discussion: “mput” is a command used to move multiple files through FTP. The “put” command is used to move just one file at a time via FTP. So, think of mput as a multi-put. What we wanted to do was to move some files from our “/Users/vg/images/” directory to the “programmerinterview/images/” directory on our remote site. After we had FTP’d to our site, we cd’d (‘cd’ is change directory) to the “programmerinterview/images/” directory on our remote FTP server. Then, we ran this command to try to move the files from our Mac desktop to our FTP server:
But, we were getting this error:
This error didn’t make much sense since we were already in the “/programmerinterview/images” directory on the remote server. So, we then tried this command:
And then we got this error:
When we saw this we thought maybe for some reason we didn’t have access to the images directory – but that didn’t make sense since we created the directory ourselves through FTP! Changing directories on FTP client and serverGetting this to work: Then all we did to make it work was before we FTP’d to the site we CD’d to the local directory with the images, then we FTP’d to the site. The problem was that we needed to be in the actual directory on our computer that contained the files that we needed to move – in this case we needed to be in the directory “/Users/vg//images/”. Since we were logged in as user ‘vg’, it would default to the directory “/Users/vg”. But, what we needed to do was change the directory so that we were actually in the directory that contained the files that we wanted to transfer to the FTP server. So, we just CD’d to the images directory on our local terminal. Once we FTP’d to the site we just CD-d to the images directory and then we ran this command:
This ran like a gem. Who would have guessed it would end up being so simple? Some simple directory changes here and there make a huge difference in the Mac Terminal and the default FTP client that it uses. The lesson here: when using FTP it’s always best to go to your local directory on your client that contains the files that you want to move. And then once you FTP to the remote site, go to the directory in which you want to place the files from your local machine. Once you do both of those things, the whole FTP process becomes much smoother! |
Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>
Subscribe to our newsletter for more free interview questions.
Follow @programmerintvw