-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuploadhandler.py
More file actions
33 lines (23 loc) · 934 Bytes
/
Copy pathuploadhandler.py
File metadata and controls
33 lines (23 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
__author__ = 'marcusfaust'
import csv, re
class uploadedCSV(file):
def __init__(self, file):
self.paths = []
self.shares = []
with open('tmp.csv', 'rU') as csvfile:
sharescsv = csv.reader(csvfile, delimiter=',', escapechar="")
for row in sharescsv:
share = row[0]
path = row[1]
path = re.sub('^[a-zA-Z]:\\\\', '/', path)
path = re.sub('\\\\', '/', path)
self.shares.append(share)
self.paths.append(path)
def outputCmds(self, server, mountpoint):
cmds = []
index = 0
for path in self.paths:
currCmd = "server_export server_2 -Protocol cifs -name \"" + self.shares[int(self.paths.index(path))] + "\" -option netbios=" + server + " \"" + mountpoint + path + "\""
cmds.append(currCmd)
index += 1
return cmds