Skip to content

Commit

Permalink
doveadm fs delete: Allow multiple paths also with -R parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Jun 21, 2016
1 parent dc9e4ab commit cb21fec
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/doveadm/doveadm-fs.c
Expand Up @@ -398,16 +398,12 @@ cmd_fs_delete_dir_recursive(struct fs *fs, unsigned int async_count,
doveadm_fs_delete_async_finish(&ctx);
}

static void
cmd_fs_delete_recursive(int argc, char *argv[], unsigned int async_count)
static void cmd_fs_delete_recursive_path(struct fs *fs, const char *path,
unsigned int async_count)
{
struct fs *fs;
struct fs_file *file;
const char *path;
unsigned int path_len;

fs = cmd_fs_init(&argc, &argv, 1, cmd_fs_delete);
path = argv[0];
path_len = strlen(path);
if (path_len > 0 && path[path_len-1] != '/')
path = t_strconcat(path, "/", NULL);
Expand All @@ -423,6 +419,17 @@ cmd_fs_delete_recursive(int argc, char *argv[], unsigned int async_count)
}
fs_file_deinit(&file);
}
}

static void
cmd_fs_delete_recursive(int argc, char *argv[], unsigned int async_count)
{
struct fs *fs;
unsigned int i;

fs = cmd_fs_init(&argc, &argv, 0, cmd_fs_delete);
for (i = 0; argv[i] != NULL; i++)
cmd_fs_delete_recursive_path(fs, argv[i], async_count);
fs_deinit(&fs);
}

Expand Down

0 comments on commit cb21fec

Please sign in to comment.