Hunter's How To's - FTP via Command Prompt

Forum Issues? Site Suggestions?

Hunter's How To's - FTP via Command Prompt

Postby Phauss » Wed Apr 20, 2011 6:06 pm

If needed, it's possible to use command prompt to access the FTP server, regardless of active or passive FTP. This gives access to computers that don't have or are unable to get a graphical FTP client, like library computers.

Open up command prompt (start menu > run > "cmd"), and type "ftp" and hit enter. You will now be using commands to connect, navigate, and send/receive files to the server through command prompt.
Code: Select all
C:\Documents and Settings\user> ftp
ftp> _

**Windows Vista and 7 users will not have a "Documents and Settings" directory in the initial path, but will instead have a "Users" directory (C:\Users\user> _).

Type "open", hit enter, then on the next line, type the address of the FTP server (aserverwith.no-ip.org).
Code: Select all
ftp> open
To aserverwith.no-ip.org_

The welcome message will appear, and a request for a username will appear. Since there is no anonymous login on the server, we'll have to enter a username and password.
Code: Select all
ftp> open
To aserverwith.no-ip.org
Connected to aserverwith.no-ip.org.
220-FileZilla Server version 0.9.37 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
User (aserverwith.no-ip.org:(none)): ***username (no asterisks)***
Password: ***password will not display characters when typed***
logged on
ftp> _

Now that you're connected to the server, simple commands can be used to navigate the server. For instance, to see the contents of the folder, type "dir" and hit enter.
Code: Select all
ftp> open
To aserverwith.no-ip.org
Connected to aserverwith.no-ip.org.
220-FileZilla Server version 0.9.37 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
User (aserverwith.no-ip.org:(none)): user
331 Password required for user
Password:
230 Logged on
ftp> dir
200 Port command successful
150 Opening data channel for directory list.
drwxr-xr-x 1 ftp ftp              0 Apr 19 03:46 Fono's Stuff
drwxr-xr-x 1 ftp ftp              0 Oct 31  2010 Important Pictures
drwxr-xr-x 1 ftp ftp              0 Feb 22  2011 Movies
drwxr-xr-x 1 ftp ftp              0 Mar 30 04:58 Music
drwxr-xr-x 1 ftp ftp              0 Apr 19 14:49 Programs
-rw-r--r-- 1 ftp ftp            276 Feb 15  2011 ReadMe (Do Not Delete).txt
-rw-r--r-- 1 ftp ftp            915 Feb 15  2011 Server Info.txt
drwxr-xr-x 1 ftp ftp              0 Apr 19 12:32 Torrent
drwxr-xr-x 1 ftp ftp              0 Nov 20  2010 Ventrilo Client
drwxr-xr-x 1 ftp ftp              0 Apr 18 00:28 WeeklyHotNakedChicksExtravaganz
a
226 Transfer OK
ftp: 654 bytes received in 0.05Seconds 13.91Kbytes/sec.
ftp> _

To go into a directory, type the "cd" command and then the directory path. For example, "cd music/hardnox" would put us in the HardNox folder inside the music directory. A quick "dir" command tells us that there's another folder inside.
Code: Select all
ftp> open
To aserverwith.no-ip.org
Connected to aserverwith.no-ip.org.
220-FileZilla Server version 0.9.37 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
User (aserverwith.no-ip.org:(none)): user
331 Password required for user
Password:
230 Logged on
ftp> dir
200 Port command successful
150 Opening data channel for directory list.
drwxr-xr-x 1 ftp ftp              0 Apr 19 03:46 Fono's Stuff
drwxr-xr-x 1 ftp ftp              0 Oct 31  2010 Important Pictures
drwxr-xr-x 1 ftp ftp              0 Feb 22  2011 Movies
drwxr-xr-x 1 ftp ftp              0 Mar 30 04:58 Music
drwxr-xr-x 1 ftp ftp              0 Apr 19 14:49 Programs
-rw-r--r-- 1 ftp ftp            276 Feb 15  2011 ReadMe (Do Not Delete).txt
-rw-r--r-- 1 ftp ftp            915 Feb 15  2011 Server Info.txt
drwxr-xr-x 1 ftp ftp              0 Apr 19 12:32 Torrent
drwxr-xr-x 1 ftp ftp              0 Nov 20  2010 Ventrilo Client
drwxr-xr-x 1 ftp ftp              0 Apr 18 00:28 WeeklyHotNakedChicksExtravaganz
a
226 Transfer OK
ftp: 654 bytes received in 0.00Seconds 654000.00Kbytes/sec.
ftp> cd music/hardNox
250 CWD successful. "/music/hardNox" is current directory.
ftp> dir
200 Port command successful
150 Opening data channel for directory list.
drwxr-xr-x 1 ftp ftp              0 Jan 26  2011 I Go Dumb Off This Heavy Metal
226 Transfer OK
ftp: 81 bytes received in 0.00Seconds 81000.00Kbytes/sec.
ftp> _

Unfortunately, the folder inside has spaces, which are rather difficult to deal with in command prompt. Normally, when there are spaces in a path, we take the first six letters and follow them with a "~1". For example, "C:\Program Files\(restofpath)" would become "C:\Progra~1\(restofpath)." Since the name of the folder in question has spaces before reaching the sixth letter, the six letter rule cannot be used. A go-around for this is simply to replace spaces with underscores when putting files and directories onto the server. An FTP browser or client would have to be used to change existing folder and file names with spaces.

To view or change the local directory, use the "lcd" command (fyi, that's a lower-case "L"). The local directory is the folder that files go to and from the server on the computer you're working from.
Code: Select all
ftp> lcd
Local directory now C:\Documents and Settings\user.
ftp> lcd c:\docume~1\user\desktop
Local directory now C:\docume~1\user\Desktop.
ftp> _

To get a file from the server, use the get command and type the file name, including the extension.
Code: Select all
ftp> cd import~1
250 CWD successful. "/import~1" is current directory.
ftp> lcd
Local directory now C:\docume~1\user\Desktop.
ftp> get 20090530.gif
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 25404 bytes received in 0.13Seconds 203.23Kbytes/sec.
ftp> _

To get multiple files, use the "mget" command. Use asterisks as wildcards, so to pull every file name of every file type, type "mget *.*", or to get every file name of only one file type, enter "*.gif."
Code: Select all
ftp> cd import~1
250 CWD successful. "/import~1" is current directory.
ftp> mget *.*
200 Type set to A
mget 0002k1cc.gif? y
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 1826566 bytes received in 0.80Seconds 2291.80Kbytes/sec.
mget 1014124938_l.gif? y
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 13714 bytes received in 0.13Seconds 109.71Kbytes/sec.
mget 1281335204057.jpg? y
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 36928 bytes received in 0.14Seconds 263.77Kbytes/sec.

...

ftp> _

Now we have a bunch of pictures on our desktops!

Now, to upload files, we do the same thing we did before. Change the local directory to the location of the needed file, then use the "put" command, followed by the file name.
Code: Select all
ftp> cd import~1
250 CWD successful. "/import~1" is current directory.
ftp> lcd c:\docume~1\user\desktop
Local directory now C:\docume~1\user\Desktop.
ftp> put untitled-1.gif
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 7866 bytes sent in 0.00Seconds 7866000.00Kbytes/sec.
ftp> _

As with the "mget" command, there is also an "mput" command to upload multiple files.

At this point, all the basics have been covered. To find more commands, like those needed to make directories, look here for a basic rundown of some more FTP commands
We are each a beautiful and unique snowflake that will melt in hell.

I got the words "jacuzzi" and "yakuza" confused.
Now I'm in hot water with the Japanese mafia.
User avatar
Phauss
Site Admin
 
Posts: 1097
Joined: Thu Oct 01, 2009 10:30 am
Location: Here and There

Re: Hunter's How To's - FTP via Command Prompt

Postby Loktarr » Wed Apr 20, 2011 6:36 pm

I love command prompt so many neat things you can mess with..
I've only used it for Ping tests and a few other things mostly ping tests though :s
Image
User avatar
Loktarr
 
Posts: 37
Joined: Wed May 19, 2010 1:41 pm
Armory: http://bit.ly/lgv8tR


Return to Suggestions and Ideas

Who is online

Users browsing this forum: No registered users and 1 guest

cron