How can I delete a folder or file with path too lo

2020-07-10 08:10发布

I have the program that deletes and copies some folders or files with long path (when lenght > MAX_PATH) In this program I use the prefix \\?\ that gives me the possibility delete folders or files with long path but only in simple function Delete(). I need to delete files in Recycle Bin and for this I need use the SHFileOperation function that gives me possibility delete files in the recycle bin, but this function does not support the prefix \\?\ . Can anybody help me with this issue?

Is there some alternative for SHFileOperation. How can I bypass this problem?

Some links:

标签: c++ winapi
1条回答
贼婆χ
2楼-- · 2020-07-10 08:49

The recycle bin is a special shell folder. It is part of the shell. The shell however has the limitation that paths must not be longer than MAX_PATH. So the same limitation applies to the recycle bin.

You simply can not put files/folders with long paths in the recycle bin. Not possible.

Edit: Windows 10 has the MAX_PATH limit lifted. See this msdn entry

查看更多
登录 后发表回答