cmd, avoiding the error "0x80070050: The file exists" when moving into Recycle bin

0

I'm deleting a lot of files (around one million) on windows server 2012 via cmd. I want them to go to the recycle bin, so I'm not using the del command, but the recycle.exe of CmdUtils. The problem is that sometimes cmd stops with the message:

An unexpected error is keeping you from deleting the file.
If you continue to receive this error you can use the error code to search for help with this problem.
Error 0x80070050: The file exists.

and then I can choose among 'Try again' 'Skip' 'Cancel'

On CmdUtils/Recycle it seems I have only the -f option for avoiding the deleting confirmation message, but it doesn't work with the error I'm getting. I've tried to contact CmdUtils developer, but no reply.

So, do you know another way for moving file into Recycle bin with the chance of automatically answer to that popup? Thanks.

cmd.exe
asked on Super User Jul 5, 2019 by solquest

1 Answer

0

The /f option doesn't avoid the confirmation message - all that does is ignore the read-only setting. What you're looking for is /q, which is quiet mode (suppresses prompts).

Depending on how you are selecting these files, I would probably use a combination of DEL and RD:

del /f /s /q yourfolder
rd /s /q yourfolder

This will avoid the recycling bin. If you clarify how you're selecting files for deletion (deleting entire folder, looping through a folder, etc.) I can give you a more specific method for getting rid of stuff.

Reference: Del, RD.

answered on Super User Jul 10, 2019 by mael'

User contributions licensed under CC BY-SA 3.0