子进程调用 find -exec 不执行

Subprocess call find -exec doesn't execute

我尝试使用 find 和 rm 通过 Python 子进程调用删除所有文件夹,包括内容。

要删除的文件夹是/root/subfolder/folder20200802

在 shell 终端的根目录中,命令有效:

find . -name 'folder2*' -type d -exec rm -rf {} \;

我的脚本,保存在根目录下,没有报错,但也没有删除文件夹:

from subprocess import call
import os

call(['find', '.', '-name', '\'folder2*\'', '-type', 'd', '-exec', 'rm', '-rf', '{}', ';']) 

通过将输出写入文件,我能够进行调试:

from subprocess import call
import os
call(['find', '.', '-name', 'folder2*', '-type', 'd', '-exec', 'rm', '-rf', '{}', ' ', ';'])