2005-07-11

メモは rcp で一箇所にあつめる作戦

ユビキタスメモは、好きなエディタで書く。書いたメモは rcp を使って、PC ごとのファイルを保存しておく。という作戦に落ち着きそうだ。rsync を使えばよいのか。




_scp = "C:/hoge/pscp"

def secureCopy(source, target, password):

"""copy source to target"""

subprocess.call((_scp, "-q", "-pw", password, source, target))



def secureList(remoteDir):

"""generate file names that meets filespec on host"""

num, path = tempfile.mkstemp()

# get filenames with scp

fout = file(path,"w")

subprocess.call((_scp, "-q", "-pw", PASSWORD, "-ls", remoteDir),

stdout = fout)

fout.close()

# parse files generated by scp

fin = file(path)

for i in range(3):

fin.readline()

for line in fin:

filename = line.split()[-1].strip()

yield filename