Your examples have a lot of unneeded or redundant code. If Not Exist "!secondLastSegment!\." MD "!secondLastSegment!" Then I used different logic by trying two for loops to get the last token, and then the 2nd last token, but it didn't work. off & setlocal EnableDelayedExpansionįor /F "EOL=? Delims=" %%G In ('Dir /A:D /B 2^>NUL Using "Tokens=-2" to get the 2nd last token wouldn't output anything. The following attempt, would only give me the 2nd token starting from the front. Note that the number of tokens in the folder with the underscores can be any length. I have a lot of files in this format: D:\images\AAA_BBB\image\whatever1.jpgĭ:\images\I'd like to move and rename these files using a substring of the absolute file path and remove the original files so that the results will look something like the below, starting with 0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |