Pular para o conteúdo principal

Two plus ways to transfer files via FTP in Windows

Two plus ways to transfer files via FTP in Windows: "
While writing the Core FTP LE Product Spotlight blog post, I discovered a new way to transfer files using FTP. It led me to wonder how many other people were unaware of the two-plus ways to transfer files via FTP using only the tools provided in Windows.

I will briefly discuss each method using Windows 7 in the examples below. These instructions will also work in Windows Vista. Each method uses a different component of Windows to initiate the transfer:

  • Internet Explorer 8
  • Windows Explorer
  • DOS command line


Method One - Internet Explorer 8


Everyone who browses the Internet should be familiar with the addresses that are typed in the browser address bar to access a Web site, for example:

http://www.microsoft.com/

The address for FTP access is similar:

ftp://ftp.microsoft.com/

Type a public FTP site address like Microsoft’s (Figure A) in the address bar and press [Return] and you can find knowledge base articles, patches, updated drivers, utilities and documentation - though the information there is now dated. View the readme.txt files at the site for more information. If you successfully connect you should see the root directory. You can click on a directory to access sub-directories and files. Download a file by Right-clicking on the file and selecting Save Target As…

This blog post is also available in the PDF format in a TechRepublic Download.

Figure A


FTP from Internet Explorer 8

Note: Tools | Internet Options | Advanced tab | Enable FTP folder view (outside of Internet Explorer) and the Use Passive FTP (for firewall and DSL modem compatibility) options under Browsing should be checked by default. If not, enable these options.

Non-public sites require a user name and password (Figure B). This is convenient for listing the files on the remote FTP server, but if you are using IE 7 or IE 8 you will need to launch Windows Explorer to transfer files. (See Figures C, D, E and F)

Figure B



Non-public sites require a user name and password

Figure C



Select Page | Open FTP Site in Windows Explorer to open Windows Explorer. Alternatively, you can select View | Open FTP Site in Windows Explorer from the menu.

Figure D



Click Allow when the Internet Explorer Security window opens.

Figure E



Enter your user name and password and select Log On to connect using Windows Explorer.

Figure F



If you connect successfully you should be able to transfer files to and from the FTP server just as you would with any local drive.

Method Two - Windows Explorer


Method one is rather awkward. You can connect to the remote server directly in Windows Explorer (Figure G and H).

Figure G



Open Windows Explorer and type the FTP address in the address bar.

Figure H



Enter return after typing the address and you will be prompted for a user name and password.

But what if you routinely connect to a FTP server? You don’t want to have to type the FTP address each time you want to connect. There are three ways to create a shortcut or link for quick access. First, connect to the FTP server in Windows Explorer.

Option one - Create a desktop shortcut


There are two ways to create a desktop shortcut for a file or folder for quick access:

  • Select the remote file or folder and press and hold down the [Ctrl][Shift] keys. Drag and drop the file or folder to the desktop.
  • Right-click on the remote file or folder and hold down the right mouse button. Drag and drop the file or folder to the desktop. Select Create shortcuts here.

Option two - Create a link under Favorites


There are two ways to create a link to a folder for quick access:

  • Drag and drop a remote folder to Favorites in the navigation pane.
  • Right-click on the remote folder and then hold down the right mouse button. Drag and drop the folder to Favorites in the navigation pane. Select Create shortcuts here.

Option three - Create a link under Computer


The Add Network Location Wizard will create a link under Computer in the navigation pane. Right-click on Computer in the navigation pane then select Add a network location to open the Add Network Location Wizard. For a complete step by step guide, please visit the associated TechRepublic Photo Gallery.

FTP folders in Windows Explorer


A Microsoft spokesperson sent me the following information about the features and limitations of FTP folders in Windows Explorer:

“FTP Folders work natively in the Windows Explorer and allow users to:

  • Browse them, in a limited way (no metadata or thumbnails)
  • Copy, move and delete files and folders
  • Create new folders
  • Search/filter the current view
  • Add to favorite links
  • Open Files using the Common File Dialog

Unsupported behavior:

  • You cannot copy or move files between folders on the server, only to and from your PC
  • There are no thumbnails, metadata or previews
  • You can only save to FTP folders using the Common File Dialog if the application supports opening from a virtual namespace (which is rare)
  • You cannot see Unicode file names
  • There are no secondary streams”

Method Three - DOS command line


The ftp.exe executable is a Windows utility that can be started from a command prompt window command line. You can manually transfer files using the FTP utility but the power of this method is automation. It is a very convenient way to schedule and automate the regular transfer of files.

To view help for the FTP utility open a command prompt window and type ftp -? [Return] at the command line. To view the commands available in FTP type ftp [Return] to start the FTP utility then type ? [Return] at the FTP prompt. Type bye [Return] at the FTP prompt to exit the FTP utility.

You can create batch files and FTP scripts in order to automate the file transfer process. In the following examples, replace the italicized text with your unique host name, user name, password, local path and remote server directory.

Editor’s note: The following commands are examples. You will have to adjust drive letters and folders to match your system.

Transfer a single file


Type the following into Notepad and save as H:\TransferTest\transfer.bat:

ftp -v -n -s:H:\TransferTest\transfer.ftp

This is what the ftp command does:

  • ftp - Invoke FTP utility
  • -v - Suppress display of remote FTP server responses
  • -n - Suppress auto-login
  • -s: - Specifies the path including the name of the file containing FTP commands. Note: The path cannot contain spaces.

Type the following into Notepad and save as H:\TransferTest\transfer.ftp:

open example.yourhostingsite.com

user yourusername

password

cd /public_ftp/test

put “W:\pecos-softwareworks\shtml\changes_to_the_windows7_taskbar_you_should_know_about.shtml”

bye

This is what the FTP commands do:

  • open - Opens the remote FTP server
  • user - Log in using the user name
  • password - Log in using the user password
  • cd - Change to the specified remote directory where you want to upload the files, /public_ftp/test in this example
  • put - Upload the specified local file. The quotation marks are optional if there are no spaces in the path.
  • bye - Quit FTP session and exit FTP

Tip: FTP commands can be abbreviated to three characters so you may see scripts written with commands like binary abbreviated to bin.

Tip: Long path names can be time consuming to type and easy to mistype. You can simplify the process by using one of these methods:

  • Navigate to the file in Windows Explorer, Right-click on any part of the breadcrumb style address in the address bar and select Copy address as text. Paste the address into your FTP script file and add the file name.
  • The full path including the file name can be copied to the clipboard. Right-click on a file in Windows Explorer, select Properties and click the Security tab. Select and copy the full path next to Object name: and paste it into your FTP script file.

From a command prompt type H:\TransferTest\transfer.bat or open the batch file to run it. You may see a Windows Security Alert (Figure I and J):

Figure I



Select the Public networks option and click Allow access.

Figure J



The put command uploads one file from the client to the server. If the file already exists on the remote server it will be overwritten.

Use the get command to download one file from the server to the client.

Transferring multiple files


Type the following into Notepad and save as H:\TransferTest\multiple_transfer.bat:

cd /D W:\pecos-softwareworks\shtml

ftp -v -n -s:H:\TransferTest\multiple_transfer.ftp

Type the following into Notepad and save as H:\TransferTest\multiple_transfer.ftp:

open example.yourhostingsite.com

user yourusername

password

cd /public_ftp/test

prompt

mput “changes_to_the_windows7_taskbar_you_should_know_about.shtml” “a_case_of_maxtaken_identity.shtml”

lcd \Projects\PSWW\VIC\Package

binary

mput “vista_image_capture_1_1_2.zip” “vista_image_capture_1_2_0.zip”

bye

This is what the FTP commands do:

  • open - Opens the remote FTP server
  • user - Log in using the user name.
  • password - Log in using the user password
  • cd - Change to the specified remote directory where you want to upload the files, /public_ftp/test in this example
  • prompt - Disables interactive prompting when uploading multiple files using the mput command
  • mput - Upload the specified local ASCII files. The quotation marks are optional if there are no spaces in the path.
  • lcd - Change to the specified local directory containing the files that will be transferred, \Projects\PSWW\VIC\Package in this example
  • binary - Switch to the binary transfer mode
  • mput - Upload the specified local binary files. The quotation marks are optional if there are no spaces in the path.
  • bye - Quit FTP session and exit FTP

From a command prompt type H:\TransferTest\multiple_transfer.bat or open the batch file to run it. (Figure K)

Figure K



Multiple transfers

Note that I used the cd change drive and directory command in the batch file and the lcd change local directory FTP command in the FTP script to simplify the mput commands so that the relative path could be used instead of the full path.

Tip: Spaces can be problematic. Use underscore characters instead of spaces when possible.

The mput command uploads multiple files from the client to the server. If the files already exist on the remote server they will be overwritten.

Use the mget command to download multiple files from the server to the client.

There are other variations of this method including creating one batch file. I’ll leave it to you to explore them if you wish.

Transferring ASCII and Binary files


FTP handles transfers of ASCII (text) files differently from binary files. By default, the Windows FTP utility transfers files using the ASCII mode. The single file example above transfers one ASCII file. The multiple file example transfers both ASCII and binary files. To avoid possible data corruption, use the right transfer mode.

Security issues


There is one obvious security issue. If you have your user ID and password in an unencrypted text file it can be read by anyone with access to the computer so you will want to encrypt the FTP script file. Search for encrypt in Windows Help and click the Encrypt or decrypt a folder or file item or view these Microsoft Web pages for how to encrypt your data with Windows 2000, Windows Server 2003, Windows XP, Windows Vista or Windows 7. Wikipedia lists the Windows operating systems that support the Encrypting File System (EFS). You can also use a third party application like TrueCrypt.

Potential firewall issues


If you receive a 425 Unable to build data connection: Connection timed out error the problem is likely with your firewall. The FTP utility does not support the passive transfer mode and this can lead to firewall issues. I received this error using Comodo Firewall 4.0 and there are several workarounds that I can detail in the forum. If you are having this issue with your firewall you will need to configure the firewall to allow access for the FTP utility.

The final word


Before you go looking for a third party app take a closer look at the tools provided in Windows. One of the above methods may be the perfect solution for your FTP needs.

Susan Harkins makes a good point in Recommend clients using FTP switch to SSL or SSH that sensitive or confidential data should not be sent using the FTP protocol.

Additional resources


Microsoft Windows Command-Line FTP Command List - nsftools.com

Active FTP vs. Passive FTP, a Definitive Explanation - Slacksite.com

ASCII or Binary? Which Files Are Which - Webweaver

Stay on top of the latest XP tips and tricks with TechRepublic’s Windows XP newsletter, delivered every Thursday. Automatically sign up today!

Author’s Note


I would like to thank Microsoft for their help with this article.


"

Comentários

Postagens mais visitadas deste blog

Improve Windows Security By Closing Open Ports

Improve Windows Security By Closing Open Ports : " A standard Windows operating system has a number of ports open after installation. Some of these ports are needed for the system to function properly while others might not. These ports can pose a security risk as every open port on a system might be an entry point for a malicious user. A port basically allows communication to or from the device. Characteristics are a port number, an IP address and a protocol type. This article will give you the tools at hand to identify and evaluate the open ports on your Windows system to make a decision in the end whether they can or should be closed or left open. Software programs and tools that we will use: CurrPorts : Available for 32-bit and 64-bit editions of Windows. It is a port monitor that displays all open ports on a computer system. We will use it to identify the ports and the programs that are using them. Windows Task Manager: Also used to identify the programs and link some p

Diagnosing a Blue Screen of Death Error in Windows

Diagnosing a Blue Screen of Death Error in Windows : For many years now the famous Blue Screen of Death (BSoD) has been the ultimate indication that something disastrous has happened to make your computer die, but how useful is the information in the BSoD and the respective crash dump file that Windows produces? The best article I ever found explaining the BSoD in depth is here on the Microsoft website, however it’s quite technical and doesn’t discuss how to actually troubleshoot a problem. The crash dump file is just technical details of what was being held in the computer’s memory at the time of the crash, and this will include details on every driver and service that was loaded, and every piece of software that was running. The most useful pieces of information are to be found on the BSoD itself and are highlighted on the screenshot below. These are the BSoD error name, the stop error code and the name of the driver or service that has failed (this last one might not always appea

FBackup is a simple, no-frills free backup application

FBackup is a simple, no-frills free backup application : "