Hi
With the Command Prompt in Windows 8.x, which command should I use to delete all files and all subdirectories of a directory without deleting this root directory?
Thanks
Bye
[Win8.x] Deleting the files and directories of an directory
Moderator: DosItHelp
Re: [Win8.x] Deleting the files and directories of an direct
Code: Select all
pushd "d:\files" && ( rmdir /s/q "d:\files" 2>nul & popd )
Re: [Win8.x] Deleting the files and directories of an direct
foxidrive wrote:Code: Select all
pushd "d:\files" && ( rmdir /s/q "d:\files" 2>nul & popd )
It works well but I have a problem:
This command must be run from another directory and, at the end of its execution, should I find myself in the same starting directory.
So, how do I reach my goal?
Thanks
Bye
Re: [Win8.x] Deleting the files and directories of an direct
The PUSHD changes to the directory you need to process. The POPD returns you to the original directory. Are you saying that is not what is happening?
Re: [Win8.x] Deleting the files and directories of an direct
Squashman wrote:The PUSHD changes to the directory you need to process. The POPD returns you to the original directory. Are you saying that is not what is happening?
Strange. When I run this command on Windows 8.x, I find myself in the directory indicated by the pushd command and not in the starting directory. Why?
Thanks
Bye
Re: [Win8.x] Deleting the files and directories of an direct
balubeto wrote:Strange. When I run this command on Windows 8.x, I find myself in the directory indicated by the pushd command and not in the starting directory. Why?
Give us a clue how you launched the batch file.
Re: [Win8.x] Deleting the files and directories of an direct
My Goodness. You asked this same question almost three years ago and we answered it basically the same way.
viewtopic.php?f=3&t=3301
viewtopic.php?f=3&t=3301
Re: [Win8.x] Deleting the files and directories of an direct
Squashman wrote:My Goodness.
Your google fu is strong.
