python script to copy files

Hello Experts,

I am looking for some solution for pulling the files from a shared network location to my linux server directory.

I only have the network shared drive path like :

\\MFILE054\storage

Open in new window


I am able to map this from my windows machine but then again I need to put the files to my linux server.

I cannot use FTP due to security reason , the only option is to use a direct connection to shared drive from linux.

I am looking for one script which will pull the files from the "storage' folder to my linux path i.e. like" /usr/temp"
LVL 17
Swadhin RaySenior Technical Engineer Asked:
Who is Participating?
 
amitnepalConnect With a Mentor Commented:
You can always mount the share on windows to your linux machine, Even set it to mount on reboots using fstab. When you mount the shared folder, it is available locally to your linux machine and you can do a regular cp from mounted partition to where ever you want on the local linux storage.

http://www.amitnepal.com/mounting-windows-share-to-linux/

Now you can create a simple bash or python script to copy files to your local linux drive as you would do a normal copy..
0
 
Swadhin RaySenior Technical Engineer Author Commented:
@amitin  : is it possible to do with sudo access ?
0
 
Swadhin RaySenior Technical Engineer Author Commented:
using sudo access I am not able to do it.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
amitnepalCommented:
It depends on what commands you are allowed to run using sudo. Can you switch to root by typing :

sudo su root

or

sudo su -

If you do not have root access or ability to switch to root, mount command might not have been allowed for you.
0
 
Swadhin RaySenior Technical Engineer Author Commented:
I will check this and will update if I still face any issue.

till then let this question be in open stage.

Thanks,
Sloba
0
 
Swadhin RaySenior Technical Engineer Author Commented:
Hi amitnepal,

The mount option is not possible ... only direct connection to the shared server and pulling the files to linux machine is the only option for me.

Is there a way where we can do this...?
0
 
gelonidaCommented:
What do you mean with 'direct connetion to the shared server'?

telnet?
ssh?
ftp? (I think you said no)
vnc?
remote desktop?
http?

Or none of above and you'd like to implement your own client / server processoes on both sides?

How important is security?
0
 
amitnepalConnect With a Mentor Commented:
You know what, run cygwin on your windows machine, that way you can ssh into windows from your linux and copy files over to linux from windows as if you were copying from linux.  You can rsync, scp , between both servers once you have cygwin on your windows machine.

Thanks
0
 
gelonidaCommented:
I agree with amitnepal's suggestion.

It's probably more robust and safr than any slf made solution.

cygwin is rather huge though and installing ssh is a little (just a little) trick,
0
 
amitnepalCommented:
with cygwin you can do custom installation and select ssh only. Also it will be useful if you need other features like rsync in the future. But if you prefer going light footprint  , you can install just ssh .

Thanks
Amit
0
 
Swadhin RaySenior Technical Engineer Author Commented:
I will check all the options and will update this question.

Thanks,
Sloba
0
 
Swadhin RaySenior Technical Engineer Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.