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
208
# sftp rename doesn't allow overwriting, so play tricks:
209
209
base = os.path.basename(new)
210
210
dirname = os.path.dirname(new)
211
tmp_name = u'tmp.%s.%.9f.%d.%s' % (base, time.time(), os.getpid(), rand_chars(10))
212
216
tmp_name = pathjoin(dirname, tmp_name)
214
218
# Rename the file out of the way, but keep track if it didn't exist