From 829de89d1f5ba987a153739e5eeaa3e27110e5d8 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Thu, 19 Jan 2012 13:22:38 -0600 Subject: Split filenames on windows --- logbot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/logbot.py b/logbot.py index 0b9eb8e..8cc23b6 100644 --- a/logbot.py +++ b/logbot.py @@ -34,6 +34,7 @@ __license__ = "GPL2" import cgi import os import ftplib +import sys from time import strftime try: @@ -205,8 +206,12 @@ class Logbot(SingleServerIRCBot): for fname in files: full_fname = os.path.join(root, fname) - remote_fname = "/".join(os.path.split(full_fname)[1:]) + if sys.platform == 'win32': + remote_fname = "/".join(full_fname.split("\\")[1:]) + else: + remote_fname = "/".join(full_fname.split("/")[1:]) if DEBUG: print repr(remote_fname) + try: self.ftp.storbinary("STOR %s" % remote_fname, open(full_fname, "rb")) except ftplib.error_perm, e: -- cgit v1.2.3-70-g09d2