Delete folders with a .bat
Solved
jedimaster10
Posted messages
17
Status
Member
-
Isobary -
Isobary -
Hello everyone
I'm in the process of finishing an add-on for a football game (FM 2007 for those who know it), but in the end, I want to integrate a .bat file into my installer so that it runs after the pack installation.
With this .bat, I want to delete 8 folders along with all their contents (both other folders and files) that are in the game's installation directory.
The folders are located at:
data\graphics\pictures\kits\clubs
data\graphics\pictures\kits\default
data\graphics\pictures\logos\background
data\graphics\pictures\logos\huge
data\graphics\pictures\logos\normal
data\graphics\pictures\logos\small
data\graphics\pictures\players\normal
data\graphics\pictures\players\small
So for example, in the "clubs" folder (the first on my list), there are subfolders that themselves may contain other subfolders and then files.
I'd like to know the code for the .bat file to perform this action.
I don't know much about this side of computing so if you could keep your explanations gentle, I would be grateful :)
Thanks in advance
I'm in the process of finishing an add-on for a football game (FM 2007 for those who know it), but in the end, I want to integrate a .bat file into my installer so that it runs after the pack installation.
With this .bat, I want to delete 8 folders along with all their contents (both other folders and files) that are in the game's installation directory.
The folders are located at:
data\graphics\pictures\kits\clubs
data\graphics\pictures\kits\default
data\graphics\pictures\logos\background
data\graphics\pictures\logos\huge
data\graphics\pictures\logos\normal
data\graphics\pictures\logos\small
data\graphics\pictures\players\normal
data\graphics\pictures\players\small
So for example, in the "clubs" folder (the first on my list), there are subfolders that themselves may contain other subfolders and then files.
I'd like to know the code for the .bat file to perform this action.
I don't know much about this side of computing so if you could keep your explanations gentle, I would be grateful :)
Thanks in advance
Configuration: Windows XP Firefox 2.0.0.2
9 answers
-
Ok, I found it:
rmdir (or rd, it's the same)
rmdir c:\bla to delete a folder
rmdir c:\bla /s to delete a folder and all subfolders
rmdir c:\bla /s /q to delete a folder and all subfolders without asking for confirmation.
Generally, if you type /? after a command, it opens help, keep that in mind!
Floÿ -
To know the "signs" after the commands:
you need to type the command name followed by /?
for example: mkdir /?
result:
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
If command extensions are enabled, MKDIR is modified as follows:
MKDIR creates all intermediate directories in the path, if necessary.
For example, suppose that \a does not exist. Then:
mkdir \a\b\c\d
is equivalent to:
mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
chdir c
mkdir d
which is what you would have had to enter if extensions were disabled.
------------------------------
To delete a file:
the command is: erase or del
followed by the path of the file: ex: c:\temp\test.txt
--> del "c:\temp\test.txt"
--> erase "c:\temp\test.txt"
note: add /Q after del or erase so that there is no confirmation prompt for deletion.
--> del /Q "c:\temp\test.txt" -
Back in the day, there was a command called deltree, look in that direction..
Floÿ -
Yes, it seems you're on the subject since that's what I want, to delete the folders and everything they contain :)
EDIT: it's good, it works: THANK YOU very much Floy :) -
Apparently, it doesn't work on Windows XP.
And I have run the tests unsuccessfully.
I might be doing it wrong.
But I'm sure there is a solution. -
well uh..
"With this .bat, I want to delete 8 folders along with all their contents (both other folders and files) that are located in the game's installation directory."
So I'm right in the subject, aren't I?
Floÿ -
-
If you can read this tutorial, you will learn a lot; that's how I started too: http://erci.no-ip.com/origine/divers/tutoriel.pdf
-
Hello
Please, can you specify how to delete a file with a '.bat' batch file?
What command is used and especially the signs after the command please?
Thank you for all your answers.