.bat script question

juggernaut911

GBAtemp Slut!
OP
Member
Joined
Jul 13, 2006
Messages
4,165
Trophies
1
Age
13
Website
google.com
XP
1,018
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!
 

kjean

Well-Known Member
Member
Joined
Sep 15, 2008
Messages
550
Trophies
0
Location
where I'm from
Website
homeless
XP
20
Country
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!
 

juggernaut911

GBAtemp Slut!
OP
Member
Joined
Jul 13, 2006
Messages
4,165
Trophies
1
Age
13
Website
google.com
XP
1,018
Country
United States
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

General chit-chat
Help Users
  • No one is chatting at the moment.
    BigOnYa @ BigOnYa: I played the intro to far cry 5, that is like some crazy Jim Jones cult shit. Still its petty...