Topic List | Page List: 1 |
---|---|
Topic | Would this be easy for a novice to code? |
Sahuagin 04/13/17 9:34:33 PM #14: | can probly do it in one line at windows command prompt (remember that if you put it in a .bat file you have to double all the % signs) closest I got so far is: for /f "tokens=1,2 delims= " %a in ('type data.txt') do rename %a %b.jpg this is assuming a data file that looks like: asdf.jpg 1 tricky thing with this is that it's hard to undo if you get it wrong. well, actually no it isn't, because you can just swap the arguments to rename. explanation: for /f loops over things (type for /? to see help)"tokens=1,2 delims= " says we want the first and second item after splitting with spacenot sure how it works exactly, but using %a means that the tokens will be in %a %b %c, etc... using a different letter doesn't work ('type data.txt') allows for to loop over each line in the file. a really useful one is ('dir /ad/b') which lists all directories in a plain formatrest is self explanatory --- The truth basks in scrutiny. http://i.imgur.com/GMouTGs.jpg http://projecteuler.net/profile/Sahuagin.png ... Copied to Clipboard! |
Topic List | Page List: 1 |