Thorax_the_Impaler
Minecraft Veteran
- Messages
- 352
- Location
- 127.0.0.1
Hello everyone!
I wasn't sure where to post this, but this section seemed appropriate. I was going through a routine backup of all my files, and I found a folder that contained a slew of batch files I made when I was a sophomore in high school. These days and even probably back then I wouldn't say batch files are often used for any tasks but I believe having a couple handy never hurt anyone. With that being said, I have the script of one file here and I'd like to ask a question to you guys that I was never able to answer myself.
The script:
@ECHO OFF
cls
ECHO This program is designed to clear out a directory.
ECHO It deletes all files in the directory, but will not touch folders.
ECHO .
ECHO .
ECHO .
set /p N=Please type the directory you wish to clear:
ECHO Press Enter to Continue:
set /P 1=%N%
ISPLAY
ECHO
ECHO .
ECHO These files will be deleted:
ECHO .
DIR %N% | FIND "Directory"
DIR %N% /B /P
ECHO .
ECHO .
ECHO To delete listed files,
ECHO Press any key:
ECHO .
ECHO To Cancel, Press: 'Control-C'
ECHO .
PAUSE >NUL
ELETE \C
DEL %N%
ECHO .
ECHO .
ECHO Task completed. Press any key to close.
:END
PAUSE >NUL
Here's my question: Why would this script completely disregard folders and such but had no qualms deleting any other file in the directory specified? (Unless of course, it didn't have the permission necessary to do so)
I wasn't sure where to post this, but this section seemed appropriate. I was going through a routine backup of all my files, and I found a folder that contained a slew of batch files I made when I was a sophomore in high school. These days and even probably back then I wouldn't say batch files are often used for any tasks but I believe having a couple handy never hurt anyone. With that being said, I have the script of one file here and I'd like to ask a question to you guys that I was never able to answer myself.
The script:
@ECHO OFF
cls
ECHO This program is designed to clear out a directory.
ECHO It deletes all files in the directory, but will not touch folders.
ECHO .
ECHO .
ECHO .
set /p N=Please type the directory you wish to clear:
ECHO Press Enter to Continue:
set /P 1=%N%
ISPLAY
ECHO
ECHO .
ECHO These files will be deleted:
ECHO .
DIR %N% | FIND "Directory"
DIR %N% /B /P
ECHO .
ECHO .
ECHO To delete listed files,
ECHO Press any key:
ECHO .
ECHO To Cancel, Press: 'Control-C'
ECHO .
PAUSE >NUL
ELETE \C
DEL %N%
ECHO .
ECHO .
ECHO Task completed. Press any key to close.
:END
PAUSE >NUL
Here's my question: Why would this script completely disregard folders and such but had no qualms deleting any other file in the directory specified? (Unless of course, it didn't have the permission necessary to do so)