LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2013, 07:51 AM   #1
Saratha
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Rep: Reputation: Disabled
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.
 
Old 03-28-2013, 08:04 AM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
You can use scp to copy files between remote hosts, like:
Code:
~$ scp -p -r /path/to/local_directory user@remotehost:/path/to/output
 
Old 03-28-2013, 08:04 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
if this is all remote, why not just use ssh properly?
 
Old 03-29-2013, 05:14 AM   #4
Saratha
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thank you...But i need to use sftp. Is there an option to assign value to a variable in remote server.

Thanks in Advance
 
Old 03-29-2013, 05:30 AM   #5
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
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
 
Old 03-29-2013, 02:37 PM   #6
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
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

Last edited by spiky0011; 03-29-2013 at 02:48 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do we know if some files and folders were added to a directory recently garima721 Linux - General 3 02-13-2012 04:31 AM
[SOLVED] Moving files from folders and subfolders to a specific folder mrj2 Linux - Newbie 12 08-22-2010 12:40 PM
Processing multiple files in a directory and moving them. keysorsoze Linux - Newbie 14 12-26-2007 05:27 AM
Files and folders that are in root directory sathish80 Linux - Newbie 1 03-17-2006 08:28 AM
moving files and folders thru command line JROCK1980 Linux - General 2 02-16-2004 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration