rename shorcuts using file location

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

rename shorcuts using file location

Postby bruno.biking » Thu May 11, 2017 2:53 am

I have a bunch of shortcut in the same folder to files in different folders on my server.
I want to rename each with the target path of the file the shortcut is pointing to.
One constrain is that each file each shortcut is pointing, is not at the same deep, it may nested in more or less folders or subfolders.

Here is an example:
The target of the shortcut is:

Shortcut before renaming:
First-Shortcut - shortcut

Shortcut after renaming:

Thanks in advance for your help!
Posts: 2
Joined: Thu May 11, 2017 2:36 am

Re: rename shorcuts using file location

Postby therube » Thu May 11, 2017 5:33 pm

The closest automated way I can think off...
Code: Select all
Compressed (zipped) Folder.ZFSendToTarget
Desktop (create shortcut).DeskLink

9:Append Folder Name
Name: Prefix
Levels: 50

Code: Select all
Documents and SettingsRUBENSendToARename.lnk
Documents and SettingsRUBENSendToBinText.lnk
Documents and SettingsRUBENSendToBRU.lnk
Documents and SettingsRUBENSendToSandboxieCLEAN.lnk
Documents and SettingsRUBENSendToCompressed (zipped) Folder.ZFSendToTarget
Documents and SettingsRUBENSendToCRC.pif
Documents and SettingsRUBENSendToSandboxieDefaultBox.lnk
Documents and SettingsRUBENSendToDesktop (create shortcut).DeskLink

But that doesn't get you your _'s.

You could do that with Named-Pairs, but that is a more manual deal.

Code: Select all
E_Documents and Settings_RUBEN_SendTo_ARename_lnk
E_Documents and Settings_RUBEN_SendTo_BinText_lnk
E_Documents and Settings_RUBEN_SendTo_BRU_lnk
E_Documents and Settings_RUBEN_SendTo_Sandboxie_CLEAN_lnk
E_Documents and Settings_RUBEN_SendTo_Compressed (zipped) Folder_ZFSendToTarget
E_Documents and Settings_RUBEN_SendTo_CRC_pif
E_Documents and Settings_RUBEN_SendTo_Sandboxie_DefaultBox_lnk
E_Documents and Settings_RUBEN_SendTo_Desktop (create shortcut)_DeskLink

copy source filenames
- append "|" to each line
copy source pathnames
- (at that point, I'd find it easier to do something like this in VIM editor:
paste both into separate files
- read each file, line by line, output to:
file1line3|file2line3 ...

If not in an editor, you could use Character Translation:
Code: Select all
Posts: 419
Joined: Mon Jan 18, 2016 6:23 pm

Re: rename shorcuts using file location

Postby bruno.biking » Thu May 11, 2017 7:38 pm

Hello therube,

Thanks for the quick reply.

This is not giving me what I want.
The shorcut is renamed with the path location where the shortcut is.
If the shortcut is on my desktop, then desktop + my windows profile name would be in the name. This is not what I want....

The way I want the shortcut to be renamed is with the path of the file the shortcut is pointing to.

For example, the new name for a shortcut labelled "abctest.lnk" pointing to "c:\somewhere\someplace\abctest.lnk" would be "C_somewhere_someplace_abctest.lnk".

Thanks everyone for taking time to answer.

Posts: 2
Joined: Thu May 11, 2017 2:36 am

Return to Javascript Renaming