print "Checking spool files and stringprepping any if necessary...",
for file in os.listdir(pre):
- file = xdb.unmangle(file).decode("utf-8")
- filej = jid.JID(file).full()
- if(file != filej):
- file = xdb.mangle(file)
- filej = xdb.mangle(filej)
- if(os.path.exists(filej)):
- print "Need to move", file, "to", filej, "but the latter exists!\nAborting!"
- os.exit(1)
- else:
- shutil.move(pre + file, pre + filej)
+ try:
+ file = xdb.unmangle(file).decode("utf-8")
+ filej = jid.JID(file).full()
+ if(file != filej):
+ file = xdb.mangle(file)
+ filej = xdb.mangle(filej)
+ if(os.path.exists(filej)):
+ print "Need to move", file, "to", filej, "but the latter exists!\nAborting!"
+ os.exit(1)
+ else:
+ shutil.move(pre + file, pre + filej)
+ except:
+ print "File: " + file
+ raise
print "done"
pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/avatars/"
if os.path.exists(pre):
for file in os.listdir(pre):
- if os.path.isfile(pre + file):
- pre2 = pre + file[0:3] + "/"
- if not os.path.exists(pre2):
- os.makedirs(pre2)
- shutil.move(pre + file, pre2 + file)
+ try:
+ if os.path.isfile(pre + file):
+ pre2 = pre + file[0:3] + "/"
+ if not os.path.exists(pre2):
+ os.makedirs(pre2)
+ shutil.move(pre + file, pre2 + file)
+ except:
+ print "File: " + file
+ raise
# Do spool files...
pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/"
if os.path.exists(pre):
for file in os.listdir(pre):
- if os.path.isfile(pre + file) and file != "notes_to_myself":
- hash = file[0:2]
- pre2 = pre + hash + "/"
- if not os.path.exists(pre2):
- os.makedirs(pre2)
-
- if(os.path.exists(pre2 + file)):
- print "Need to move", file, "to", pre2 + file, "but the latter exists!\nAborting!"
- os.exit(1)
- else:
- shutil.move(pre + file, pre2 + file)
+ try:
+ if os.path.isfile(pre + file) and file != "notes_to_myself":
+ hash = file[0:2]
+ pre2 = pre + hash + "/"
+ if not os.path.exists(pre2):
+ os.makedirs(pre2)
+
+ if(os.path.exists(pre2 + file)):
+ print "Need to move", file, "to", pre2 + file, "but the latter exists!\nAborting!"
+ os.exit(1)
+ else:
+ shutil.move(pre + file, pre2 + file)
+ except:
+ print "File: " + file
print "done"