|
-
Feb 19th, 2001, 03:40 PM
#1
Thread Starter
Junior Member
This time i will make it clear what i am trying to establish...please help me...
firstly, i have lots of files with extension *.zip(for example 123.zip) after i unzip them it gives me *.mp3(123.mp3-same name but different extension). However, there are some spoilt zip files which does not produce *.mp3. What i want is to del those zip files which is successfully extracted to give its mp3 files, and then keep the spoilt ones. i have created the batch file to delete the zip files but it does not spare the spoilt ones. therefore i thought of a way by using the command "dir/b *.mp3 > goodmp3.bat" to produce the list of unzip files, then i use a string replacement program to edit the goodmp3.bat by replacing all ".mp3" strings with ".zip" string. Now goodmp3.bat contains the list of zipfiles that are not spoilt. while the rest are spoilt. i can rename the bat file into a textfile therefore, by adding "del " to every line in the goodmp3.bat file, i can del the good zip files and keep the bad ones. can someone help me on this, how to do that(by adding string to everyline valid-not empty lines) using visual basic? is there a better and faster way?
In additional, Can someone help me on the part:
adding "del " string to every line of the batch file and stop adding after the last valid line with a filename is reached
the list goes like this:
1.zip
dcasd.zip
asdad.zip
asdasd.zip
...etc
what i want is the final file:
del 1.mp3
del dcasd.mp3
del asdad.mp3
del asdasd.mp3
...etc
with out adding any unneccessary "del "
to those empty lines that follow in the end of the file
-
Feb 21st, 2001, 02:17 PM
#2
Fanatic Member
you should use the file scripting object. Make a reference through project references to the File Scripting runtime. use This to filter the file types you want to use and then the Stream object to open them and/or write out a fresh file. it's easy to create a new line with your del in. MSDN also has some examples on how to use it if your unsure.
-
Feb 21st, 2001, 03:16 PM
#3
Addicted Member
is it okay if you add 'del' manually. I mean code the del by '&' function so it shows up, or you don't wanna do that?
Atif AKA AK
VB 5.0
VB 6.0 Professional
VBA, Macros, JAVA, C++
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|