@echo off setlocal enabledelayedexpansion rem Set the output file name and path set output_file=risultati_dell_estrazione.xlsx rem Delete the output file if it already exists if exist "%output_file%" del "%output_file%" rem Write the column headers to the output file echo "Nome cartella estratta","Stato estrazione">>"%output_file%" rem Loop through all RAR and ZIP files in the current directory and its subdirectories for /r %%f in (*.rar *.zip) do ( rem Extract the file if "%%~xf"==".rar" ( "C:\Program Files\WinRAR\WinRAR.exe" x -y "%%f" "%%~dpf%%~nf\" ) else if "%%~xf"==".zip" ( "C:\Program Files\WinRAR\WinRAR.exe" x -y "%%f" "%%~dpf%%~nf\" ) rem Get the name of the extracted directory set "extracted_dir=%%~nxf" rem Write the name of the extracted directory and the status of the extraction to the output file if exist "!extracted_dir!" ( echo "!extracted_dir!",Success>>"%output_file%" ) else ( echo "!extracted_dir!",Error>>"%output_file%" ) ) echo Estrazione completata. I risultati sono stati salvati in "%output_file%". rem Convert the CSV to an Excel file using pandas python -c "import pandas as pd; df = pd.read_csv('risultati_dell_estrazione.xlsx'); writer = pd.ExcelWriter('risultati_dell_estrazione.xlsx', engine='xlsxwriter'); df.to_excel(writer, index=False); workbook = writer.book; worksheet = writer.sheets['Sheet1']; worksheet.set_column(0, 0, 50); worksheet.set_column(1, 1, 20); header_format = workbook.add_format({'bold': True, 'text_wrap': True, 'border': 1, 'bg_color': '#D3D3D3', 'font_color': 'white'}); worksheet.set_row(0, None, header_format); writer.save()" echo La tabella è stata salvata in "risultati_dell_estrazione.xlsx". Premi un tasto per uscire. pause>nul
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)