|
Answer» Alright lets say for example I have the following file structure C:\Users\user name\DOWNLOADS\
Now in downloads, there are folders. If I ONLY wanted to delete the folders in "Downloads" but not anything else how would I go about doing that. So to reiterate, I want to delete the sub-directories in Downloads, but not "Downloads" itself. How would I do that in Command Prompt Windows 7. del c:\src\file.txt Deletes c:\src\file.txt.
echo.y|del c:\temp\*.* Deletes all files in c:\temp without stalling for the usual Y es/ N o confirmation. The pipe replies Y es. The exact reply letter required is LANGUAGE specific.
del c:\temp\*?.* Deletes all files in c:\temp without stalling for the usual Y es/ N o confirmation. The WILDCARD *?.* is EQUIVALENT to the global *.* (since all files have at least one character in their base name), but *?.* avoids a stall. This alternative isn't language specific.
del "c:\my src\*.TMP" Deletes all files with extension TMP in c:\my src ("quote" path or name if it contains Space s). That's only for files. I want to remove sub directories without calling the specific name. I want remove the sub directories in the "Downloads" folder, but leave Downloads itself. I can't use a wild card, is there anyway to delete them without calling each one specifically?
Code: [Select]@echo off cd c:\Users\User\Downloads dir /AD /b > subdir.txt for /f "delims=" %%i in (subdir.txt) do ( echo %%i cd %%i echo Y | del *.* cd .. rd %%i ) Output: C:\Users\User\Downloads>subdir.bat temp C:\Users\User\Downloads\temp\*.*, Are you sure (Y/N)? Y tmp C:\Users\User\Downloads\tmp\*.*, Are you sure (Y/N)? Y
C:\Users\User\Downloads>dir /AD /b
C:\Users\User\Downloads>
|