I used a unix utility (cygwin's tar) to copy a file tree from a hard drive to a stick. One of the things I learned was that file links/ shortcuts contain a full path to their target rather than a relative path. These are the files created by "Paste shortcut" or Shift-Ctrl- Drag. After the file tree is copied to the stick, all such file links no longer point to valid destinations. I used a text editor like vim to look at the file shortcuts, and I can see the full path to the target. Is there a hopefully simple way to convert these paths to relative paths? I guess that would also depend on whether file shortcuts can even point to targets using relative paths. Moreover, is there a hopefully simple way to traverse a file tree and convert all file shortcuts to use relative paths? Failing that, is there a simple way to replace all file shortcuts with their target files throughout a subtree in the file hierarchy? I am looking to do this on both Windows 2000 and Windows XP.
Other than using a Windows program to do what your are doing I don't know if I can help Since this is a special program you might have better luck to post this question to a support group for that Program http://gmane.org/find.php?list=cygwin See what they say? Just a thought? Russ -- Russell Grover - SBITS.Biz [SBS-MVP] Microsoft Gold Certified Partner Microsoft Certified Small Business Specialist 24hr SBS Remote Support - www.SBITS.Biz Question or Second Opinion $25.00 - www.PersonalITConsultant.com Free Trial Microsoft Online Services - www.Microsoft-Online-Services.com "AndyHancock" <andymhancock@gmail.com> wrote in message news:86c60d85-adfc-4ac7-b9af-c25c7898bbe8@3g2000yqn.googlegroups.com... > I used a unix utility (cygwin's tar) to copy a file tree from a hard > drive to a stick. One of the things I learned was that file links/ > shortcuts contain a full path to their target rather than a relative > path. These are the files created by "Paste shortcut" or Shift-Ctrl- > Drag. After the file tree is copied to the stick, all such file links > no longer point to valid destinations. > > I used a text editor like vim to look at the file shortcuts, and I can > see the full path to the target. Is there a hopefully simple way to > convert these paths to relative paths? I guess that would also depend > on whether file shortcuts can even point to targets using relative > paths. > > Moreover, is there a hopefully simple way to traverse a file tree and > convert all file shortcuts to use relative paths? > > Failing that, is there a simple way to replace all file shortcuts with > their target files throughout a subtree in the file hierarchy? > > I am looking to do this on both Windows 2000 and Windows XP.
"AndyHancock" <andymhancock@gmail.com> wrote: > I used a unix utility (cygwin's tar) to copy a file > tree from a hard drive to a stick. One of the things > I learned was that file links/shortcuts contain a > full path to their target rather than a relative path. > These are the files created by "Paste shortcut" or > Shift-Ctrl-Drag. After the file tree is copied to the > stick, all such file links no longer point to valid > destinations. Question: What good are links to files if you remove them from the computer that contains the files they link to? Are the files in question programs that are on both the source and destination machines, or something like that? > I used a text editor like vim to look at the file > shortcuts, and I can see the full path to the target. I just went to folder "DLibrary" on my computer, right-click-dragged file "Bike-Shops.txt" to "D", selected "create shortcut". I renamed the shortcut to "Aardvark" (no extention). But yet, it DOES have an extention, because when I look at it with a "dir" command from a command prompt, it's actual name is "Aardvark.lnk". On opening it with "edit", it contains binary (non-text) gibberish, interspersed with characters from the absolute path: "DLibrary\Bike-Shop.txt". I can't see how you could edit that; it's a binary file. Attempting to edit "DAardvark.lnk" GVim resulted in GVim opening "DLibrary\Bike-Shops.txt" instead. Are you *sure* you were able to edit a link in Vim? (That is, are you sure that what you edited wasn't the TARGET rather than the LINK?) > Is there a hopefully simple way to convert these > paths to relative paths? I guess that would also > depend on whether file shortcuts can even point to > targets using relative paths. Moreover, is there > a hopefully simple way to traverse a file tree and > convert all file shortcuts to use relative paths? To the best of my knowledge, there is no such thing as a "relative-path shortcut" in any Microsoft Windows version. If you think about it, what you are trying to do makes little sense. Firstly, "relative path" links would work only with link on same drive as target, whereas in reality, a link on drive D: often refers to a file on drive E: or C: or X:. Secondly, people move shortcuts around all the time; if shortcuts had link info relative to their own location, that info would be invalidated the moment the shortcut was moved. > Failing that, is there a simple way to replace all > file shortcuts with their target files throughout > a subtree in the file hierarchy? I don't know a simple way to replace a bunch of shortcuts with their targets, no. I suppose you could find or write a program, or have someone write one for you. (I could write it for you, but I don't work for free.) But more importantly, why would you want to do that? Be aware that if the targets are programs (exe files), if you move them to new locations, they probably won't work, because they'll be looking for files they need (such as dll files) and not finding them. Also be aware that replacing shorcuts with targets can increase space used by several orders of magnitude. (Consider a link to an mp3 file. The link takes 1KB. The target takes 10000KB.) Instead of trying to replace the shortcuts with their targets (dubious idea, in my opinion), why not look for a way to simply correct the shortcuts so they point to the right location? Or MUCH better, look for a way to generate fresh shortcuts on the destination computer, rather than trying to copy shortcuts from another computer which may not even have the same collection of targets? When I need to make shortcuts to things, I right-click my desktop, select "Create New Shortcut", navigate to the target, specify a name for the shortcut, hit "OK". Then I move the shortcut to its final location (usually one of my toolbars). Perhaps if you say more specifically what you are trying to do, it would help folks here to give you better advice. -- Cheers, Robbie Hatley lonewolf at well dot com www dot well dot com slant tilde lonewolf slant
"AndyHancock" <andymhancock@gmail.com> said this in news item news:86c60d85-adfc-4ac7-b9af-c25c7898bbe8@3g2000yqn.googlegroups.com... > I used a unix utility (cygwin's tar) to copy a file tree from a hard > drive to a stick. One of the things I learned was that file links/ > shortcuts contain a full path to their target rather than a relative > path. These are the files created by "Paste shortcut" or Shift-Ctrl- > Drag. After the file tree is copied to the stick, all such file links > no longer point to valid destinations. > > I used a text editor like vim to look at the file shortcuts, and I can > see the full path to the target. Is there a hopefully simple way to > convert these paths to relative paths? I guess that would also depend > on whether file shortcuts can even point to targets using relative > paths. > > Moreover, is there a hopefully simple way to traverse a file tree and > convert all file shortcuts to use relative paths? > > Failing that, is there a simple way to replace all file shortcuts with > their target files throughout a subtree in the file hierarchy? > > I am looking to do this on both Windows 2000 and Windows XP. There is a utility called shortcut.exe (http://www.optimumx.com/download/#Shortcut) that you can use to modify shortcuts in bulk. Below you can see the help file that goes with it. The site appears to be unavailable right now. If it does not recover and if you're interested then I'll copy the utility to a SkyDrive. Shortcut [Version 1.11] Creates, modifies or queries Windows shell links (shortcuts) The syntax of this command is: Shortcut.exe /F:filename /A:C|E|Q [/T:target] [/Parameters] [/W:workingdir] [/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description] /F:filename : Specifies the .LNK shortcut file. /A:action : Defines the action to take (C=Create, E=Edit or Q=Query). /T:target : Defines the target path and file name the shortcut points to. /Parameters : Defines the command-line parameters to pass to the target. /W:working dir : Defines the working directory the target starts with. /R:run style : Defines the window state (1=Normal, 3=Max, 7=Min). /I:icon,index : Defines the icon and optional index (file.exe or file.exe,0). /H:hotkey : Defines the hotkey, a numeric value of the keyboard shortcut. /D:description : Defines the description (or comment) for the shortcut. Notes: - Any argument that contains spaces must be enclosed in "double quotes". - If Query is specified (/A:Q), all arguments except /F: are ignored. - To find the numeric hotkey value, use Explorer to set a hotkey and then /A:Q - To prevent an environment variable from being expanded until the shortcut is launched, use the ^ carat escape character like this: ^%WINDIR^% Examples: /f:"%ALLUSERSPROFILE%\Start Menu\Programs\My App.lnk" /a:q /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:c /t:^%WINDIR^%\Notepad.exe /h:846 /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:e /p:CSetup.log /r An argument of /? or -? displays this syntax and returns 1. A successful completion will return 0. Copyright 2000-2005 Marty List, www.OptimumX.com ================================================================== Revision History: 1.11 07/04/2005 - Fixed display problem for hotkeys with extended characters. - Removed reference to .URL files in the syntax, since URL files are not supported yet. 1.10 12/20/2003 - Fixed COM memory leak, enhanced exit/result codes, enhanced syntax. 1.00 10/02/2000 - Initial release.
"AndyHancock" <andymhancock@gmail.com> said this in news item news:86c60d85-adfc-4ac7-b9af-c25c7898bbe8@3g2000yqn.googlegroups.com... > I used a unix utility (cygwin's tar) to copy a file tree from a hard > drive to a stick. One of the things I learned was that file links/ > shortcuts contain a full path to their target rather than a relative > path. These are the files created by "Paste shortcut" or Shift-Ctrl- > Drag. After the file tree is copied to the stick, all such file links > no longer point to valid destinations. > > I used a text editor like vim to look at the file shortcuts, and I can > see the full path to the target. Is there a hopefully simple way to > convert these paths to relative paths? I guess that would also depend > on whether file shortcuts can even point to targets using relative > paths. > > Moreover, is there a hopefully simple way to traverse a file tree and > convert all file shortcuts to use relative paths? > > Failing that, is there a simple way to replace all file shortcuts with > their target files throughout a subtree in the file hierarchy? > > I am looking to do this on both Windows 2000 and Windows XP. See the highly detailed replies you received to your identical post in the Win2000 newsgroup, then have a look at this link to see the advantages of using cross-posing rather than multi-posting. Multi-posting leads to duplication of effort! http://www.blakjak.demon.co.uk/mul_crss.htm
"AndyHancock" <andymhancock@gmail.com> said this in news item news:86c60d85-adfc-4ac7-b9af-c25c7898bbe8@3g2000yqn.googlegroups.com... Apologies - please ignore my reply about multi-posting. You did actually cross-post but I must have had a mental BSOD.