.bat script question

juggernaut911

GBAtemp old-timer
Member
Joined
Jul 13, 2006
Messages
4,165
Reaction score
34
Trophies
2
XP
1,051
Country
United States
Okay so I'm creating a script that will delete file names that are listed in a file called contents.txt

Contents.txt
Code:
a.as
b.as
[.code]

I want the script to delete the file name of Contents.txt so this would happen:

folder\a.as
folder\b.as
folder\contents.txt

to end up as:

folder\contents.txt

which I will have deleted after it is parsed.

Please help! URGENT!
 
This example below is no recursive, means only for single folder, and require grep. Better methods will be welcomed.

OK, grab Binaries and Dependencies of "grep" from HERE and extract it somewhere you like, in this example it's in C:\GREP\

Contents.bat
QUOTE said:
SET PATH=C:\GREP\
FOR /f %%A IN ('grep -9999 a Contents.txt') DO del %%AWTF! Only one line except path?!?!?!?

Contents.txt
QUOTE said:
a.txt
b.txt

Target dir. - Before
QUOTE said:
a.txt
b.txt

c.txt
d.txt
Contents.bat
Contents.txt
run "Contents.bat"

Target dir. - After
QUOTE
c.txt
d.txt
Contents.bat
Contents.txt
Voila!
 
kjean said:
This example below is no recursive, means only for single folder, and require grep. Better methods will be welcomed.

OK, grab Binaries and Dependencies of "grep" from HERE and extract it somewhere you like, in this example it's in C:\GREP\

Contents.bat
QUOTE said:
SET PATH=C:\GREP\
FOR /f %%A IN ('grep -9999 a Contents.txt') DO del %%AWTF! Only one line except path?!?!?!?

Contents.txt
QUOTE said:
a.txt
b.txt

Target dir. - Before
QUOTE said:
a.txt
b.txt

c.txt
d.txt
Contents.bat
Contents.txt
run "Contents.bat"

Target dir. - After
QUOTE
c.txt
d.txt
Contents.bat
Contents.txt
Voila!

I'll look into that! Thank you so much!
biggrin.gif
 

Site & Scene News

Popular threads in this forum