Delete folders with a .bat

Solved
jedimaster10 Posted messages 17 Status Membre -  
 James -
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
Configuration: Windows XP Firefox 2.0.0.2

9 answers

ButterFloÿ Posted messages 1116 Status Contributor 126
 
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ÿ
47
guy2mars Posted messages 210 Status Member 71
 
attention, a rmdir destroys the directory and all files.
it's best to create a .bat file using a dos command and put a code like del c:\your path\*.bat
you chain the instructions ..
if you click on it, it executes it
.
0
adc
 
adf
0
James
 
ça marche vraiment
0
m3teor
 
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"
13
ButterFloÿ Posted messages 1116 Status Contributor 126
 
Back in the day, there was a command called deltree, look in that direction..

Floÿ
3
jedimaster10 Posted messages 17 Status Member 8
 
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 :)
3
ButterFloÿ Posted messages 1116 Status Contributor 126
 
You're welcome, next time if you understand English, do a Google search in English, it works well too..

Floÿ
0
jedimaster10 Posted messages 17 Status Member 8
 
Okay, thanks for the tip.

It's true that I looked in French but there's not much on that.

I'll have a better chance in English indeed.
0
jedimaster10 Posted messages 17 Status Member 8
 
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.
2
ButterFloÿ Posted messages 1116 Status Contributor 126
 
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ÿ
2
wild_child
 
Thank you!! Thank you for your responses!! They are really going to help me!!
0
Isobary
 
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
0
wild_
 
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.
-6