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