<commit_before>from os import listdir,rename,remove
from os.path import isdir,isfile,join,splitext,getsize
from click import echo
import click

@click.command()
@click.option('-f',type=click.STRING, help="Folder path")
@click.option('-nm',type=click.STRING, help="Name")
def sync(f,nm):

	"""Synchronizes the names of the folder and its subcontents to the given name"""

	if isdir(f):
		for file in listFilesInDescBySize(f):
			split = splitext(file);
			if split[1] in ('.jpg','.txt','.nfo','.com'):
				remove(file)
				echo('Removed Junk File %s' %file)
			else:
				echo('Renaming %s' %file)
				try:
					rename(file,join(f,nm+split[1]))
				except FileExistsError:
					echo('File %s reported to be existing' %file)
					remove(file)
		rename(f,nm)
	else:
		raise ValueError('This command works only for directorys.')<commit_msg>Bit more details in commit and introduced secho. But its not working!!<commit_after>from os import listdir,rename,remove
from os.path import isdir,isfile,join,splitext,getsize
from click import echo,secho
import click

@click.command()
@click.option('-f',type=click.STRING, help="Folder path")
@click.option('-nm',type=click.STRING, help="Name")
def sync(f,nm):

	"""Synchronizes the names of the folder and its subcontents to the given name"""

	if isdir(f):
		for file in listFilesInDescBySize(f):
			split = splitext(file);
			if split[1] in ('.jpg','.txt','.nfo','.com'):
				remove(file)
				echo('Removed Junk File %s' %file)
			else:
				newName = join(f,nm+split[1])
				echo('Renaming %s to %s' % (file,newName))
				try:
					rename(file,newName)
				except FileExistsError:
					secho('File %s reported to be existing. So removing %s' % (newName,file),blink=True, bold=True, fg='red', bg='white')
					remove(file)
		echo('Renaming folder %s to %s' %(f,nm))
		rename(f,nm)
	else:
		raise ValueError('This command works only for directorys.')
{'fraction_non_alphanumeric': 0.15156332803391626, 'fraction_numerical': 0.0021197668256491787, 'mean_word_length': 4.66966966966967, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5779334', 'n_tokens_mistral': 731, 'n_tokens_neox': 654, 'n_words': 182}