LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Moving files between Folders in Remote directory (https://www.linuxquestions.org/questions/linux-newbie-8/moving-files-between-folders-in-remote-directory-4175455903/)

Saratha 03-28-2013 07:51 AM

Moving files between Folders in Remote directory
 
Hi,
I'm new to shell scripting. I need to move files between folders in remote directory.I'm connecting to remote server by sftp. I tried using rename command. it works only if i give the full file name.But i need to transfer more files.It'll not be possible to give all file names. Are there any way available to accomplish this. Any help is appreciated.

Thanks
Saratha.

shivaa 03-28-2013 08:04 AM

You can use scp to copy files between remote hosts, like:
Code:

~$ scp -p -r /path/to/local_directory user@remotehost:/path/to/output

acid_kewpie 03-28-2013 08:04 AM

if this is all remote, why not just use ssh properly?

Saratha 03-29-2013 05:14 AM

Thank you...But i need to use sftp. Is there an option to assign value to a variable in remote server.

Thanks in Advance

spiky0011 03-29-2013 05:30 AM

Hi

I use
Code:

sftp -o PORT=port no user@ip add:/route/to/file
The ls command works on remote host

lls works on local

spiky0011 03-29-2013 02:37 PM

Hi

Just reread your post, If you want to move files once you have sftp in, cd to the dir you want to get/put file. On local host lcd to dir where you want file.

run command

>sftp
Code:

get file .
that will get the file from the remote dir and put it the local dir you are in.

Hope that makes sense

If you are moving files on remote machine between the dirs on it then ssh would be better


All times are GMT -5. The time now is 01:43 AM.