[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 701
  • Last Modified:

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"
0
Swadhin Ray
Asked:
Swadhin Ray
  • 6
  • 5
  • 2
2 Solutions
 
amitnepalCommented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
amitnepalCommented:
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now