How can I copy a file from a local machine to a remote ubuntu server using putty?

How can I copy a file from a local machine to a remote ubuntu server using putty?

I used the command "scp -r localfile.txt username@", but it seems that localfile.txt must reside on a specific location, otherwise the file cannot be located.  Please help!  Thanks.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

torimarConnect With a Mentor Commented:
If you are using a Windows computer for copying to the remote server, the easiest way is to take WinSCP:
WinSCP does make use of Putty and of the SCP client that comes with Putty. It's in essence just an interface for SCP.

If you insist on using the command line SCP though, make sure either your source file is in the current directory (the one you are in when issueing the copy command), or the exact path is given, i.e. c:\some_folder\localfile.txt
First, make sure that you have the full path to localfile.txt.

"scp -r </full/path/to/localfile.txt> username@",

Another alternative is to make sure that you are in the directory where "localfile.txt" exists first, by typing:  cd /path/to/localfile.txt, then issue the scp command.
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

pisceswzh2010Author Commented:
To torimar:

I will try your method and see.  Thanks.
pisceswzh2010Author Commented:
To mikepflu:

Actually I'm copying files from a Windows 7 machine to the Ubuntu and I'm using putty to ssh into the Ubuntu from the Windows 7 machine.  I'm not sure how should I construct the full path to localfile.txt.  Should I use a shared folder or what?  Thanks.
pisceswzh2010Author Commented:
This is convenient!  Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.