views:

15

answers:

2

1>

I have folder inside folders structure.

2> I want to recursively create shortcut to every file.

the shortcuts must be place inside the same named folders, that it is at its source.

3>

Summary: same folder structure...just shortcuts in place of files

Any ideas will be appreciated.

A: 

Do you need help with the recursion, or just some quick ideas on how to accomplish this? I'm not going to write it, but you could use a recursive batch file where the initial command looks like:

batchFile.bat "C:\OriginalLocation" "C:\CopyToLocation"

I believe the only problem would be that you would need an external program to create the shortcuts (a quick google search turns up some). You may be able to use VBScript to do the same thing without needing an external shortcut creating program (again, a google search came up with a few ways to do that).

Ocelot20
A: 

here's a vbscript you can try

Set objFS = CreateObject( "Scripting.FileSystemObject" )
Set oWS = WScript.CreateObject("WScript.Shell") 
strFolder=WScript.Arguments(0)
Set objFolder = objFS.GetFolder(strFolder)
Go (objFolder)
Sub Go(objDIR)
  If objDIR <> "\System Volume Information" Then
    For Each eFolder in objDIR.SubFolders
        Go eFolder
    Next
    For Each strFile In objDIR.Files
        shortcut = objFS.BuildPath(objFS.GetParentFolderName(strFile), objFS.GetBaseName(strFile)&".lnk")
        Set oLink = oWS.CreateShortcut(shortCut) 
        oLink.TargetPath = strFile.Path
        oLink.WorkingDirectory = objFS.GetParentFolderName(strFile)
        oLink.Save
        Set oLink=Nothing
    Next
  End If 
End Sub 

Usage:

C:\test> cscript //nologo mycreateshortcutscript.vb C:\test
ghostdog74