Moving Files via. SSH

  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

Hello!

I am new to your forums. I have searched them regarding some methods regarding how I can transfer files server to server. Let me present you with my situation.

I have a client who is currently hosting their site on a shared hosting environemnt. He does not have SSH access to the site, only FTP. Due to some difficulties, I was able to convince them to get their own managed server (from Rackspace).

Now.... their current site has a ton ton of pictures that need to be transferred to the new site. I would like to do this via. SSH so that I can grab the files from the old hosting directly to the new server (since it will be much faster).

Ok.... so now some more details.

I would like to copy the directory of http://www.oldhost.com/pics/ to the directory /var/www/vhosts/newhost.com/httpdocs/pics/

I tried using wget, but that doesn't seem to work.

I am a total SSH noob, so I am assuming I was doing something wrong. I know our server also has "lftp" installed, and "mget" doesn't seem to be working.

I hope this is helpful. I look forward to your responses, sorry that this is so lengthy I'm just trying to cover all the info.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

Are you doing this from a command line? If so, you should be using sftp instead.

If you're doing this from a graphical environment, use WinSCP for Windows or GFTP for Linux.
  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

I'll use whatever method gets the job done :)

This is what I have actually ended up doing since I'm a little pressed for time...

On the old site, I enabled directory viewing..... (via. htaccess)
I pulled up the pics directory, copied and pasted all of the file names.

Then I made a .sh file like so:

# /bin/sh

wget -nv -P newdir/ http://www.site.com/pic/pic1.jpg

Since i just had to paste in all the file names, I then did a find and replace on all of the file names and added the wget and URL in front of them..... didn't take that long at all :)

Once the file was ready, just ran it from SSH on the new server.
  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

Oh, and the final .sh file has 10,000 lines of wget commands lol. Should take a while for the server to process that!
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

Use a graphical client and you can just drag the folder containing everything to the local server and walk away.
  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

I tried using CuteFTP Professional, since I had bought it a few months ago. It wouldn't work for some reason.

Any idea why?
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

Because CuteFTP isn't an SSH client, you need to download WinSCP, google for it
  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

Well that's certainly good to know! Thanks!
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

http://winscp.net/eng/download.php
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Or you could just just used SCP, which is part of the SSH package.

First you tar up your stuff;
tar -cpvf pictures.tar /dir/path/to/allyourpicturesdir/

Then just scp them.

scp pictures.tar <username>@<new node>:/path to where you want them_dir/

Go back there, and untar.

Tar -xpvf pictures.tar
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

He mentioned CuteFTP, so I figured he was on Windows. If there's a Linux version, I don't even want to know about it.
  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

However, I had mentioned that I do not have SSH access to the old server, only the new server. So I can't tar anything up, and the visual SSH doesn't seem to be working either.
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

Sorry, didn't see that. Just use your FTP client to get the files then.
  • delta32
  • Newbie
  • Newbie
  • delta32
  • Posts: 11

Post 3+ Months Ago

Daemonguy wrote:
Or you could just just used SCP, which is part of the SSH package.

First you tar up your stuff;
tar -cpvf pictures.tar /dir/path/to/allyourpicturesdir/

Then just scp them.

scp pictures.tar <username>@<new node>:/path to where you want them_dir/

Go back there, and untar.

Tar -xpvf pictures.tar



U NEED NOT TAR IT,
even scp has got that option too....
scp -r <directory> <userid>@<remotehost>:</home/>

the option -r will copy the dir and the sub dirs with all the files.. :D
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

delta32 wrote:


U NEED NOT TAR IT,
even scp has got that option too....
scp -r <directory> <userid>@<remotehost>:</home/>

the option -r will copy the dir and the sub dirs with all the files.. :D


NO, you don't NEED to tar, however when transferring a large amount of files it just makes good sense to do it. Compression will reduce the file size, ergo reducing the transfer time. That will in-turn reduce the opportunity for error.

If this is over a distance (ie. not on the same local network), I would tar it. I would also GZIP it for that matter.
  • simon.kiedyk
  • Newbie
  • Newbie
  • simon.kiedyk
  • Posts: 7

Post 3+ Months Ago

Except, like I mentioned a few times, I do not have SSH access to the source server, only FTP access. I have SSH access to the destination server only, which is why I cannot TAR it.

Anyhow, this issue is long resolved I just made a manual script for wget for each of the files....

Thanks for your replies.

Post Information

  • Total Posts in this topic: 16 posts
  • Users browsing this forum: No registered users and 38 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.