Deleting items via the command-line is pretty easy.
del /options filename.extension
Now, suppose I want to delete all files which do not end with .jpg in a folder, how would I do that.
The thing is, I have a piece of software that converts all specified images to .jpg, but it leaves the originals, which I don't need anymore.
It would be much more efficient to execute a single statement, compared to doing multiple statements for every different filetype.
Answer
I would do it like this:
attrib +r *.jpg
del /q *
attrib -r *.jpg
This will first make all JPG files read-only, delete everything else (it will automatically skip read-only files), and then make the JPG files writeable again.
No comments:
Post a Comment