Delete folder instread of overwrite if already exists
This commit is contained in:
parent
77e05d663e
commit
6dc406fddb
2 changed files with 7 additions and 1 deletions
|
|
@ -113,7 +113,7 @@
|
|||
function handleStartClick() {
|
||||
if (existingFolder) {
|
||||
const folder = existingFolder;
|
||||
const message = `"${folder.name}" already has ${folder.image_count} images (${formatSize(folder.size_bytes)})${folder.has_video ? ' and a compiled video' : ''}.\n\nClick OK to overwrite.`;
|
||||
const message = `"${folder.name}" already has ${folder.image_count} images (${formatSize(folder.size_bytes)})${folder.has_video ? ' and a compiled video' : ''}.\n\nAll existing content in ${folder.name} will be permanently deleted.\n\nClick OK to continue.`;
|
||||
|
||||
if (confirm(message)) {
|
||||
startProcessing();
|
||||
|
|
|
|||
|
|
@ -101,6 +101,12 @@ async fn run_job_inner(
|
|||
let folder_name = sanitize_folder_name(params.person_name.as_deref(), ¶ms.person_id);
|
||||
let person_dir = config.output_dir.join(&folder_name);
|
||||
|
||||
// If the folder exists, delete all its contents to start fresh
|
||||
if person_dir.exists() {
|
||||
tracing::info!("Removing existing folder: {}", person_dir.display());
|
||||
tokio::fs::remove_dir_all(&person_dir).await?;
|
||||
}
|
||||
|
||||
// Create output directories
|
||||
let images_dir = person_dir.join("images");
|
||||
tokio::fs::create_dir_all(&images_dir).await?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue