topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 12:24 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Shortcuts Creator  (Read 16965 times)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
DONE: Shortcuts Creator
« on: June 15, 2012, 07:12 PM »
I've encountered a new need hopefully one of you can help with:

Given:  One folder full of large-sized image files, around 15,000 files in all.  Called IMAGE FOLDER.

Task: 
-- Create another folder outside of IMAGE FOLDER with name XXX01 FOLDER.
-- For any images in IMAGE FOLDER whose name has "XXX01" in it, create a shortcut within XXX01 FOLDER to those images.

-- Create another folder outside of IMAGE FOLDER with name XXX02 FOLDER.
-- For any images in IMAGE FOLDER whose name has "XXX02" in it, create a shortcut within XXX02 FOLDER to those images.

-- Create another folder outside of IMAGE FOLDER with name XXX03 FOLDER.
-- For any images in IMAGE FOLDER whose name has "XXX03" in it, create a shortcut within XXX03 FOLDER to those images.

etc.

In total there will be 180 of these shortcut folders needing to be created.  Each of these shortcut folders will have around 180 shortcuts in it.

Challenge:
Write program that does the above automatically.
Input --- folder in which to search.
Input --- what exactly to look for.
Input --- list of new folders to create.
Go!

Thanks to all of you.

Nicholas Kormanik
[email protected]

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #1 on: June 15, 2012, 07:18 PM »
I could add another output method to my File Punter application and it should do what you want.  You'd have to use a little bit of RegEx but that's not so hard.  =]

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #2 on: June 15, 2012, 07:31 PM »
What a saint!!  Just please guide on the RegEx, as sometimes it's a bit tricky.

Is the explanation of what I'm trying to do clear enough?

Creating the shortcuts in the folders is my attempt not to have to copy the image files themselves over and over and over again into the various folders.

The names of the image files include at least two of the searched-for snippets.

Example:  XXXX32_XXXX79.png

Thanks so much!

Hope this will be useful to others as well.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #3 on: June 15, 2012, 07:35 PM »
So, given this filename: XXXX32_XXXX79.png

What do you want to match on?

If you could provide me, in a PM or something, a sample list of the actual filenames (and subsequent matches), that would be most helpful for testing.  Feel free to look up my profile and contact me via any of the instant messengers there.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #4 on: June 15, 2012, 07:55 PM »
Given the filename XXXX32_XXXX79.png....

I will be matching on two snippets, if manually in two different steps.

First I'll be matching on "XXXX32".  Creating a folder XXXX32.  And putting a shortcut to the file XXXX32_XXXX79.png within that folder.

Then I'll be matching on "XXXX79".  Creating a folder XXXX79.  And putting a shortcut to the file XXXX32_XXXX79.png within that folder.

As background to what I'm attempting to accomplish:

The image files are 'contour plots' of the two variables, in the present case variables 32 and 79.

Within XXX32 folder, there will be shortcuts to all the contour plots which variable 32 plays a part.

So, in XXX32, there will be shortcuts to the following image files:

XXXX32_XXXX01.png
XXXX32_XXXX02.png
XXXX32_XXXX03.png
XXXX32_XXXX04.png
.
.
.
XXXX32_XXXX180.png

Having all the variable 32 shortcuts in one folder -- XXX32 -- would allow me to focus on just those images at one time.

Then I could move on to the variable 33 folder -- XXX33 -- for instance, and look at just the images where variable 33 plays a part.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #5 on: June 15, 2012, 10:22 PM »
Give this a try: File Punter v1.0.4.2

1) Download, unzip, and launch FilePunter.
2) Click the green plus button and create two rules like this (obviously, change the paths to accommodate your system):

First rule
  • Choose the correct source folder.
  • Leave the Recurse source folder checkbox unchecked.
  • Pattern:  (.*)_
  • Check the Pattern is a regular expression checkbox.
  • Destination:  c:\path\to\destination_1\??1
  • vGW_L1 108.pngDONE: Shortcuts Creator


Second rule
  • Choose the correct source folder.
  • Leave the Recurse source folder checkbox unchecked.
  • Pattern:  _(.*)\.
  • Check the Pattern is a regular expression checkbox.
  • Destination:  c:\path\to\destination_2\??1
  • vGW_L1 109.pngDONE: Shortcuts Creator


It should look something like this when you're done:

vGW_L1 105.pngDONE: Shortcuts Creator

3) Check each of the rows.
4) Change the method dropdown to Create shortcuts.
5) Click the Start button.

Let us know if you have great success or epic failure.   :D
« Last Edit: June 16, 2012, 12:29 PM by skwire »

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #6 on: June 16, 2012, 01:27 AM »
Thanks, Skwire, for adding the "Create Shortcuts" option.  I think that's exactly what's needed.  Thanks, too, for the clear instructions.

I'm still somewhat unclear on regular expressions, but will experiment and continue learning.

Hope this has been helpful for others as well.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #7 on: June 16, 2012, 01:58 AM »
This feedback may better belong in the File Punter thread.  But..., I tried the new "Create Shortcuts" option using plain wildcards, and no shortcuts were produced in the destination folder.

"Copy files to destination" worked fine.

"Simulation only" worked fine.

code used:

C:\Downloads    *.jpg     C:\4     No     No


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #8 on: June 16, 2012, 12:26 PM »
I tried the new "Create Shortcuts" option using plain wildcards, and no shortcuts were produced in the destination folder.

Yep, I hadn't added it to that portion of the application.  It should function in this build:  File Punter v1.0.4.3

Please let me know if the app functions how you like.  If so, I'll promote it to v1.0.5 and release it on my main site.  Thanks for testing.  =]

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #9 on: June 16, 2012, 05:05 PM »
Bingo!

Amazing program, Skwire.

Really nice touch, too, that the destination folders need not actually exist, but will be automatically created.  That is an extremely important feature.

Seems, in answer to my original request, that using plain wild cards alone will do the trick using your program.  User just needs to create a text file containing the snippets one per line.  And import that text file into File Punter.  Press start.

I suppose using Regular Expressions, though, would be more efficient.  Trouble is, I have yet to figure out RegEx....

Fantastic job!  Thanks a million.


nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #10 on: June 16, 2012, 05:15 PM »
One additional little feature you could add would be a button to "Select All" -- instead of user having to click in every single box.

Say, if user imports a text file of 200 lines, so that 200 check boxes would need to be manually clicked on.

Better to have a "Select All" or "Check All" button.

Maybe a "Check None" as well.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #11 on: June 16, 2012, 05:35 PM »
There are check/uncheck buttons in the toolbar that should do what you want.
 :D

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #12 on: June 16, 2012, 07:59 PM »
Seems, in answer to my original request, that using plain wild cards alone will do the trick using your program.  User just needs to create a text file containing the snippets one per line.  And import that text file into File Punter.  Press start.
Say, if user imports a text file of 200 lines, so that 200 check boxes would need to be manually clicked on.

Hmmm...are you creating 200 separate rules for your use?  If so, maybe we can help out with a RegEx that will do what you need?  Did the RegEx I provided earlier work for you?

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #13 on: June 16, 2012, 11:55 PM »
I haven't created the actual files yet.  Was planning ahead.  Figuring that, of course, it would take any programmer a week or so to come up with something.  That is, if they could at all.

I didn't figure on Skwire completing the task in a few hours....

However, I do have a list of the files that should result.  Here is a partial list:

50501_20104_21901.png
50501_20104_21902.png
50501_20104_21903.png
50501_20104_22001.png
50501_20104_22002.png
50501_20104_22003.png
50501_20104_22004.png
50501_20104_22005.png
50501_20104_22006.png
50501_20104_22101.png
50501_20104_22102.png
50501_20104_22103.png

There will be 16,110 of these image files.  Let's assume that all these image files are held in the folder:

c:\contour plot images\

Pairing up the second and third sections of each file name -- these two variables are the x and y in a contour plot.

The first section of the file name, 50501 here, is the z variable in the contour plot.

It's the second and third sections of each file name that I want to focus on in providing shortcuts.

There are a total of 180 variables in the second and third name-section combinations.

So the task, for instance, if 20104 is mentioned in the filename, create subdirectory 20104, and make a shortcut in that folder to the image file which contains its name:

c:\contour plot shortcuts\20104\50501_20104_21901.png.lnk  (i.e., a shortcut)
etc.

In the 21901 folder will appear the exact same shortcut, because 21901 is mentioned in the filename:

c:\contour plot shortcuts\21901\50501_20104_21901.png.lnk  (i.e., a shortcut)
etc.

There will be 180 shortcut folders.  And 180 shortcuts in each folder.  (Maybe 179, actually.)

Using File Punter..., 180 lines of commands, one for each of the variables.

c:\contour plot images\     *20104*     c:\contour plot shortcuts\20104     No     No
c:\contour plot images\     *21901*     c:\contour plot shortcuts\21901     No     No
etc.

Pretty straight forward.

Only issue will be getting tabs between the component parts of the commands in the text file which will be imported by File Punter.  I'm assuming that tabs as delimiters are indeed needed (as opposed to spaces).  Please mention if that's not the case.  I think it would have to be, because of spaces being in the file path.  Hmmm.  What's the easiest way to get tabs between the component parts?



skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #14 on: June 17, 2012, 12:04 AM »
Using File Punter..., 180 lines of commands, one for each of the variables.

No need for 180 rules; you can do this in two rules using Regular Expressions.  Follow the same instructions as in my previous post but change the patterns to the following:

First rule pattern:       .*_(.*)_
Second rule pattern:   .*_(.*)\.

Those two rules should accomplish what you want.  =]

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #15 on: June 17, 2012, 12:26 AM »
Wow!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #16 on: June 17, 2012, 01:24 PM »
Did you give those rules a try and, if so, did they work as you wanted?

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #17 on: June 17, 2012, 05:27 PM »
It'll take a few days to create the actual image files.  For now I've created 'dummy' image files, to test.

So, in the following subdirectory are 16110 files:

c:\images\

Partial list of those files:

50501_20104_21901.png
50501_20104_21902.png
50501_20104_21903.png
50501_20104_22001.png
50501_20104_22002.png
50501_20104_22003.png
etc.

I've created an empty subdirectory in which to hold the shortcuts File Punter will create:

c:\shortcuts\

I've set up File Punter as follows:

C:\Images     .*_(.*)_     C:\Shortcuts     No     Yes
C:\Images     .*_(.*)\.     C:\Shortcuts     No     Yes

I haven't tried running yet, because I'd like assistance on the "Destination."  Above in this thread you said to use the following:

Destination:  c:\path\to\destination_1\??1
Destination:  c:\path\to\destination_2\??1

Please change your instructions for the actual case at hand.  I'm not following what exactly to do regarding "Destination."

End result should be:

c:\shortcuts\20104\50501_20104_21901.png.lnk  (i.e., a shortcut)
etc.

c:\shortcuts\21901\50501_20104_21901.png.lnk  (i.e., a shortcut)
etc.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #18 on: June 17, 2012, 05:45 PM »
I've set up File Punter as follows:

C:\Images     .*_(.*)_     C:\Shortcuts     No     Yes
C:\Images     .*_(.*)\.     C:\Shortcuts     No     Yes

The way you have it should work perfectly.   :up:

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #19 on: June 17, 2012, 06:12 PM »
Okay, just tried it, the way I have it above.  File Punter created the shortcuts.  But put all the shortcuts into one subdirectory:

c:\shortcuts\

All 16110 of 'em.

So, it appears that the "Destination" will have to be changed from what I have, in order to create the separate folders per filename section within c:\shortcuts\.

By the way, nice touch that File Punter remembers the previous setup, and populates the order on that.

Also..., going to put up another program request:  Folder Properties Auto-Update....



skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #20 on: June 17, 2012, 06:35 PM »
Okay, just tried it, the way I have it above.  File Punter created the shortcuts.  But put all the shortcuts into one subdirectory:

c:\shortcuts\

Ah, crap, my fault.  Make your destinations for each of those two rules like this:

c:\Shortcuts\??1

After doing that, try it again and let me know.  Apologies.   :-[

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #21 on: June 18, 2012, 03:46 AM »

Okay, Skwire, worked just as you said it would.

I also tried the regular wild card route, and that worked fine as well.

One possible enhancement, but not a big deal, would be some sort of 'status line' at bottom of program window saying how many items were checked.

For instance, using the regular wild card route, I had 180 lines.  Would be good to see "Checked Items = 180" or some such.

Not a biggie, though.

Thanks for all the work on this project.  I greatly appreciate it.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: Shortcuts Creator
« Reply #22 on: June 18, 2012, 02:47 PM »
Thanks for all the work on this project.  I greatly appreciate it.

You're welcome.  Thanks for the testing.   :Thmbsup:

https://www.donation....msg291261#msg291261