1.

Solve : Delete all files apart from all video types and images?

Answer»

i ment to say there on on C:\ the external HDD is H and no foldes just the files These two commands will USE drive h: and the file.txt will be saved on your desktop.
Follow the points I outlined in the earlier post.

CODE: [Select]dir h:\*.* /b /a-d |findstr /v /i /L ".MPG .mkv .mpg .mpeg .jpg .png .bmp .gif" >"%userprofile%\desktop\file.txt"

Code: [Select]for /f "usebackq delims=" %a in ("%userprofile%\desktop\file.txt") do del "%a"Ive ran the file txt ill keep you posted when i COME back later Ive ran the Delete side of the script and it saying files not found :/

[attachment deleted by admin to conserve space]Quote from: blackrainbow on November 24, 2014, 10:00:28 AM

Ive ran the Delete side of the script and it saying files not found :/
You know it is possible to copy and paste text from the CMD window.Squashman yeahh i know that, Since you are not running both commands from the H:\ drive on the command PROMPT then you need to hard code both commands to use the H: drive.

Code: [Select]for /f "usebackq delims=" %a in ("%userprofile%\desktop\file.txt") do del "H:\%a"how would i do that ive tried to use the dir H:\ bfor the code
Quote from: blackrainbow on November 24, 2014, 10:55:44 AM
how would i do that ive tried to use the dir H:\ bfor the code
Well you don't need to if you use the small code variation I made to Foxidrive's code.

Code: [Select]C:\Users\Squashman>H:

H:\>I'm sorry, I initially used a recursive search and removed the /s while editing it because you hadn't mentioned if there were subdirectories, but Squashman's modification will work if all the files are in H:\ and the following modification should work too if there are no subdirectories - I put the /s back in.

Code: [Select]dir h:\*.* /s /b /a-d |findstr /v /i /L ".mpg .mkv .mpg .mpeg .jpg .png .bmp .gif" >"%userprofile%\desktop\file.txt"

Code: [Select]for /f "usebackq delims=" %a in ("%userprofile%\desktop\file.txt") do del "%a"

ive done it following squashmans adcive thanks guys :D


Discussion

No Comment Found