emat/util/xmle/file_util.py
def rotate_file(filename, format="%(basename)s.%(number)03i%(extension)s"):
	"""
	Renames all existing files matching the pattern by increasing the number by 1.
	:param filename:
	:param format:
	:return:
	"""
	if os.path.exists(filename):
		pathlocation, basename, extension = filename_split(filename)
		fn = lambda n: os.path.join(pathlocation, format % {'basename': basename, 'extension': extension, 'number': n})
		n = 1
		while os.path.exists(fn(n)):
			n += 1
		while n > 1:
			os.rename(fn(n - 1), fn(n))
			n -= 1
		os.rename(filename, fn(1))
	else:
		raise FileNotFoundError("File %s does not exist" % filename)

	Renames all existing files matching the pattern by increasing the number by 1.
	:param filename:
	:param format:
	:return:
	
Renames all existing files matching the pattern by increasing the number by 1.
Renames all existing files matching the pattern by increasing the number by 1 .
def rotate_file(filename, format="%(basename)s.%(number)03i%(extension)s"):
	if os.path.exists(filename):
		pathlocation, basename, extension = filename_split(filename)
		fn = lambda n: os.path.join(pathlocation, format % {'basename': basename, 'extension': extension, 'number': n})
		n = 1
		while os.path.exists(fn(n)):
			n += 1
		while n > 1:
			os.rename(fn(n - 1), fn(n))
			n -= 1
		os.rename(filename, fn(1))
	else:
		raise FileNotFoundError("File %s does not exist" % filename)
def rotate_file ( filename , format = "%(basename)s.%(number)03i%(extension)s" ) : if os . path . exists ( filename ) : pathlocation , basename , extension = filename_split ( filename ) fn = lambda n : os . path . join ( pathlocation , format % { 'basename' : basename , 'extension' : extension , 'number' : n } ) n = 1 while os . path . exists ( fn ( n ) ) : n += 1 while n > 1 : os . rename ( fn ( n - 1 ) , fn ( n ) ) n -= 1 os . rename ( filename , fn ( 1 ) ) else : raise FileNotFoundError ( "File %s does not exist" % filename )
Renames all existing files matching the pattern by increasing the number by 1.
Renames all existing files matching the pattern by increasing the number by 1 .
"""
	Renames all existing files matching the pattern by increasing the number by 1.
	:param filename:
	:param format:
	:return:
	"""
None
filename
None
format
None