Copying Files Between Windows and Linux using PuTTY

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copying Files Between Windows and Linux using PuTTY

570,276 Views
bonzo
NXP Employee
NXP Employee

Here's a neat way to transfer files between your Windows PC and your Linux (Ubuntu) project using Ethernet.


PuTTY is a program that connects one device to another over the network.  It supports SSH and Telnet, among others. 


PuTTY is a “client” application that talks to a “host”.  The host must be running an SSH server (which is often the case for iMX Linux enabled systems).


A Windows version exists and this is ideal for transferring files between your Windows PC and a Linux Platform.


Download PuTTY here:  http://www.chiark.greenend.org.uk/~sgtatham/putty/


Select the Windows Installer version.  This installs the programs and help files you will need.


File transfers can be done using PSCP (Putty Secure CoPy) or by using PSFTP (Putty Secure File Transfer Protocol). 


PSFTP can be launched from the Windows Start.


PSCP must be launched from within a DOS box (StartWingdings"">àRun and enter cmd, then press OK).  Before
running PSCP, you need to set the path variable.  At the DOS command prompt, type


set PATH=C:\Program Files\PuTTY


This assumes you installed PuTTY in C:\Program Files\PuTTY (default).  Note the “\” slash.   


This will only work for the lifetime of that particular console window. To set your PATH more permanently on Windows NT, 2000, and XP, use the Advanced tab of the System Control Panel (right-click on MyComputer then select Properties).  Click the Environment Variables button, high-light “path” and edit it.  Add “;C:\Program Files\PuTTY” at the end of
the line.  You can then verify the path is correct by typing “path” at the DOS prompt.


The format for pscp is straight forward:


pscp [options] source destination


To copy a Windows file to Linux system, at the DOS prompt, type


pscp c:/music.mp3  ubuntu@10.0.0.3:/home/ubuntu/Music


which will copy the file music.mp3 to my Music folder into Linux.  My Ubuntu EVK has an ip address as 10.0.0.3.  (Note that you can use either / or \ for the Windows files and directories, but you must use / when specifying the Linux files.)


The reverse works as well (copy Linux file to Windows)


            pscp ubuntu@10.0.0.3:/home/ubuntu/Music/music.mp3 c:/


This copies the music.mp3 file from Linux into my C root directory.


There are many other options available, including the ability to use the ftp protocol as well.  See the help file for more information.


0 Kudos
3 Replies

37,639 Views
zasilmedina
Contributor I

Hi,

I'm accesing to an Ubuntu system thru a Windows system using PSCP form PuTTY, but I need to get the last file created on a folder in the Ubuntu system.

For now this is the script what i have, but it retrieves all the files on the unit_logs folder.:

set PATH=C:\Program Files (x86)\PuTTY;%PATH%

pscp

pscp finaltest@192.168.1.26:unit_logs/* C:\Users\Zasil-Ha\Documents

What should I do to get the last file created on that folder???

Thank you.

Best Regards...


0 Kudos

37,639 Views
Swamy
Contributor III

I got it...we need to use something like this....

pscp -scp -pw root c:/dummy.txt root@192.168.10.2:/

And also we need to provide passwd for the target...which is in my case root

0 Kudos

37,639 Views
Swamy
Contributor III

Thanks for the nice post.

I am working on the IMX53 Sabre Tablet, I want to transfer the files from my PC to the target. I used your procedure to send, but it is asking me for the password, where my target does not have the password option, if i type root as the username...it directly logs in. In this case how shall I use it.

Please suggest

C:\>pscp c:/dummy.txt  root@10.246.77.178:/home/
root@10.246.77.178's password:

Regards,
Swamy

0 Kudos