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

Hello,
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:
C:\folder1\subfolder1\subfolder2\subfolder3\subfolder4\file1.abc

Shortcut before renaming:
First-Shortcut - shortcut

Shortcut after renaming:
C_folder1_subfolder1_subfolder2_subfolder3_subfolder4_file1_abc

Thanks in advance for your help!
bruno.biking
 
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
ARename.lnk
BinText.lnk
BRU.lnk
CLEAN.lnk
Compressed (zipped) Folder.ZFSendToTarget
CRC.pif
DefaultBox.lnk
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:
%s/\\/_/g
%s/\./_/)
paste both into separate files
- read each file, line by line, output to:
file1line1|file2line1
file1line2|file2line2
file1line3|file2line3 ...

If not in an editor, you could use Character Translation:
Code: Select all
\=_
.=_
therube
 
Posts: 1314
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.

Bruno
bruno.biking
 
Posts: 2
Joined: Thu May 11, 2017 2:36 am


Return to Javascript Renaming


cron