LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 07-06-2016, 02:23 PM   #1
swcs
LQ Newbie
 
Registered: Jul 2016
Posts: 4

Rep: Reputation: Disabled
How to move files on remote windows using a linux command


I am newbie to linux, I need a linux command to move set of files from one folder to another on windows box remotely. I want to know is it really possible through script/command.
I tried smbclient, when i use it for moving files I have to perform two step process:

1. copy remote windows files from folder1 to linux box first. - using mget

2. then copy those files to folder2 on remote windows - using mput.

because of the above process, when I have large files it becomes too much time consuming and nullifies the purpose of speed in my automation process. So I need a command/script to speed up my process and avoid copy over of files from linux to windows.
 
Old 07-06-2016, 02:56 PM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
You appear to be using ftp to perform a simple move operation.
ftp is a data transfer protocol and so transfers all the data!

Provided you have some kind of network connection, you could just issue a command to be carried out by the remote machine which will do all the work.

One possibility - which provides a GUI interface - is to use a program called VNC.
This would allow you to rename folder1 to folder2 using a Windows command.
VNC is available in Linux & Windows

Or are your requirements more complex?
 
Old 07-06-2016, 04:08 PM   #3
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
Hello and welcome to the forum

Also, just as a suggestion, you might want to change your username using the instructions at the top of the page here, lest your email inbox ends up with a boatload of SPAM in the very near future.

Regards...
 
Old 07-06-2016, 04:24 PM   #4
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
More information is needed, like version of Linux.

I would use scp, since it is encrypted and less headaches then nfs or samba.

Hopefully you are running ssh on whatever version of Linux you are using...?

https://garron.me/en/articles/scp.html
 
Old 07-06-2016, 04:28 PM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
You need to provide more details. What services is the Windows box hosting? Is it running an ftp server? ssh server? Are the files/directories being shared?
 
Old 07-06-2016, 09:46 PM   #6
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,161

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Try WinSCP, check it out. You can copy files from Windows to Linux or Linux to Windows.

But depending on the amount of data you're copying, WinSCP might be a bit slower.
 
Old 07-07-2016, 09:39 AM   #7
swcs
LQ Newbie
 
Registered: Jul 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ardvark71 View Post
Hello and welcome to the forum

Also, just as a suggestion, you might want to change your username using the instructions at the top of the page here, lest your email inbox ends up with a boatload of SPAM in the very near future.

Regards...
Thanks for providing the instructions link to change username, I was looking for that to avoid spam. I requested to change my userid through contact us(hopefully it will be done quickly). My initial thought while creating username was that I'll be provided with an option to have a display name for my posts and my username will not be used.
 
Old 07-07-2016, 11:25 AM   #8
swcs
LQ Newbie
 
Registered: Jul 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Here are more details about my query:
I want to move files under folder1 content to backup folder on a remote windows box(app hosting machine) from a linux box(build machine) in an automated way(I can't use any GUI, it should be scripted so that the script can be scheduled to run).
This is only one step out of my automation process that I am trying to do:

1. Get the new files from repository and some manipulation of them in linux box(build box)

2. stop the windows app service.

3. move existing content to a backup folder(on targeted windows box) - question is related to this step.

4. move files prepared in step.1 to targeted windows box.

5. Restart windows app service.

It's a typical scenario, Usually all of our prod app hosting and build/code deployment boxes are that of linux so automation scripts for moving and updating stuff was simple. but in this scenario I have a app hosting box as a windows but build machine that i have to use is a linux(common build box).
I have large files under folder1 so if I copy from windows(from folder1) to linux and then from linux to windows back(into backup) it's taking long time. So I want to move those files on folder1 to backup on windows box itself using a command from linux box.
I have those folders shared on windows box and ftp running on that windows box.

Hope this helps in providing better picture on my requirement.
 
Old 07-07-2016, 11:56 AM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
So it sounds like you're accessing the windows box through ftp?
Look into the lftp tool, it's built for accessing ftp servers from within a script, and it supports "mv" which can be used to move or rename files on the server.
 
Old 07-07-2016, 01:38 PM   #10
swcs
LQ Newbie
 
Registered: Jul 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
So it sounds like you're accessing the windows box through ftp?
Look into the lftp tool, it's built for accessing ftp servers from within a script, and it supports "mv" which can be used to move or rename files on the server.
I am presently using smbclient to connect to the windows box not ftp.
 
Old 07-07-2016, 02:07 PM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by sudhakar.wcs@gmail.com View Post
I am presently using smbclient to connect to the windows box not ftp.
You literally just said that the windows box was running ftp, but either way...can't you just mount the windows share on the linux box using cifs then?
 
  


Reply



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
LXer: What's the best way to move 60 million files from one Windows server to another? - Linux LXer Syndicated Linux News 0 09-25-2010 04:50 AM
Move files from Linux to Windows Goddard Linux - Newbie 8 11-11-2009 08:02 PM
cannot using FTP move command to move files adrianmak Linux - Networking 4 04-21-2009 12:01 PM
How to Move Files from Windows to Linux b18b Linux - Networking 8 03-20-2006 06:03 PM
Move remote files with gFTP? SharpyWarpy Linux - Software 5 03-28-2004 08:30 PM

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

All times are GMT -5. The time now is 02:31 AM.

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