LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to move files on remote windows using a linux command (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-move-files-on-remote-windows-using-a-linux-command-4175583926/)

swcs 07-06-2016 02:23 PM

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.

JeremyBoden 07-06-2016 02:56 PM

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?

ardvark71 07-06-2016 04:08 PM

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...

JockVSJock 07-06-2016 04:24 PM

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

suicidaleggroll 07-06-2016 04:28 PM

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?

JJJCR 07-06-2016 09:46 PM

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.

swcs 07-07-2016 09:39 AM

Quote:

Originally Posted by ardvark71 (Post 5571475)
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.

swcs 07-07-2016 11:25 AM

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.

suicidaleggroll 07-07-2016 11:56 AM

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.

swcs 07-07-2016 01:38 PM

Quote:

Originally Posted by suicidaleggroll (Post 5571968)
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.

suicidaleggroll 07-07-2016 02:07 PM

Quote:

Originally Posted by sudhakar.wcs@gmail.com (Post 5572031)
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?


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