如何递归删除以“xxxxx”开头的目录?

时间:2013-01-03 06:16:33

标签: visual-c++ directory

我需要删除以特定字符串“user”开头的目录,我还需要删除目录中的所有子文件夹。 我使用了removeirectory,只有当它为空时才删除目录。

1 个答案:

答案 0 :(得分:0)

    Normally I would open a command window then cd to the directory you want to delete,
    Enter the command: "del /S /F *.* *" to delete all files and subdirectories.
    Backup to the parent directory: cd ..
    Remove the directory: rmdir "user*"

    Use "del/?" to see all the options for del.

    If you have to do this in c++, you can use the "system()" call.

    BTW: I did not test this just now, so no guarantee.