Sublime Forum

Macro not working like it should

#1

I am trying to get a list of all .JPG’s on my computer. I am trying to make a macro but it doesn’t want to work. My end result I want is a list of just the filename.jpg. No paths. No directories. The best list I was able to come up with was to go to a cmd prompt C:
Then:
dir *.jpg /s /b > c:\users\username\desktop\JPGDir.txt

It gives me a list of 40,400 jpg’s listed like so: (I do art and websites)

C:\ProgramData\Corel\Corel PaintShop Pro 2020\Languages\EN\Help\Corel_PaintShop_Pro\images\google_map.jpg
C:\users\username\desktop\gradient-editor-bar.jpg

The macro I am trying to create is this:
CTRL+F and search for backslash (forum won’t let me put it in)
Click back in the document at the front of a line
CTRL+Q
[END]
CTRL+F3
back (right) arrow one time
SHIFT+HOME
DEL
arrow down
CTRL+Q

That should get rid of all the information except for just the filename.jpg, but it only erases the initial C I was in front of originally and drops a line. Can I not use SHIFT+F3 in a macro? Could someone offer a different solution to what I am accomplish? Mind you I have over 40k jpg’s and want to automate this process without having to click each line and run a macro.

0 Likes

#3

Two simple ways I have in my mind.

  • Regex replace ^.*\\([^\\]+)$ with $1.
  • Find all (alt+f3) \ → shift+home → left_delete → right_delete

I seem to find a ST bug about regex replacing… lol

0 Likes