Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)

        def unique_file(file_name):
	counter = 1
	file_name_parts = os.path.splitext(file_name) # returns ('/path/file', '.ext')
	while 1:
		if not os.path.lexists( file_name):
			return file_name
		file_name = file_name_parts[0] + ' (' + str(counter) + ')' + file_name_parts[1]
		counter += 1
        


src/c/o/comictagger-1.1.14-beta/comictaggerlib/taggerwindow.py   comictagger(Download)
							skipped_list.append( ca.path )
						elif dlg.fileConflictBehavior == ExportConflictOpts.createUnique:
							export_name = utils.unique_file( export_name )
 
					if export_name is not None:

src/c/o/comictagger-1.1.14-beta/comictaggerlib/cli.py   comictagger(Download)
 
		folder = os.path.dirname( os.path.abspath( filename ) )
		new_abs_path = utils.unique_file( os.path.join( folder, new_name ) )
 
		suffix = ""
			return
 
		new_file = utils.unique_file( os.path.join( new_file ) )
 
		delete_success = False

src/c/o/comictagger-1.1.14-beta/comictaggerlib/renamewindow.py   comictagger(Download)
 
			folder = os.path.dirname( os.path.abspath( item['archive'].path ) )
			new_abs_path = utils.unique_file( os.path.join( folder, item['new_name'] ) )
 
			os.rename( item['archive'].path, new_abs_path)