202
202
:param old: The old path, to rename from
203
203
:param new: The new path, to rename to
204
204
:param rename_func: The potentially non-atomic rename function
208
209
# sftp rename doesn't allow overwriting, so play tricks:
209
210
base = os.path.basename(new)
210
211
dirname = os.path.dirname(new)
211
tmp_name = u'tmp.%s.%.9f.%d.%s' % (base, time.time(), os.getpid(), rand_chars(10))
212
214
tmp_name = pathjoin(dirname, tmp_name)
214
216
# Rename the file out of the way, but keep track if it didn't exist