hi,
I have 100 files say File1.mp3, File2.mp3 .......file100.mp3
i found that File1.mp3 to File50.mp3 are damaged.
I want to delete the damaged files from the directory using sed with regex how can i do this.
thanks
hi,
I have 100 files say File1.mp3, File2.mp3 .......file100.mp3
i found that File1.mp3 to File50.mp3 are damaged.
I want to delete the damaged files from the directory using sed with regex how can i do this.
thanks
Unless the assignment requires you to use sed and a regex, your requirements don't indicate you need to use them.
If you know them to be in the set File1.mp3 to File50.mp3, you might be able to do the following:
ls ./File?.mp3 ./File[12345]?.mp3 to see that this list matches up with what you know to be bad
then
rm ./File?.mp3 ./File[12345]?.mp3 to delete them
./File[12345]?.mp3 can also be written as ./File[1-5]?.mp3
obviously, thanks for the alternative
One more simple script, but without use of sed:
for line in File*.mp3;do
rm -f $line
done
it will delete files above file50.mp3 (e.g. file100.mp3) too...that is why file?.mp3 and file[1-5]?.mp3...