I have a path mydir where i have file1,file2, .. file100 each folder have .crc,.bak etc, files i want to remove all files and keep only .parquet files and name the .parquet files with folder name for eg., file1 folder have .crc,.bak files after removing we end up with .parquet i need to name this as file1.parquet.
I tried to remove one folder but couldnot do it for all folders uisng python
can someone help me how to solve this
mydir='c/users/name/files'
for f in os.listdir(mydir):
if f.endswith(".parquet"):
continue
os.remove(os.path.join(mydir, f))