How to? Get both path to and target of symbolic link/junction...

May 24, 2010
Northlake, Il
One one hand, I use a lot of symbolic links. On the other hand this leads to much duplication when backing up to an external hard drive unless the "/L" parameter is used, but I would assume that those copied symbolic links point to the location of the directory on the internal hard disk that is the source of the backup. (This is actually OK other than the fact that I'd like to know that the links exist.) So the question is this: Is there any way to get a listing of all of the symbolic links on a hard drive and where they "point" to? The "dir" command will tell you that a directory is a symbolic link/junction and what it points to but will not tell you (on the same line as is done when using the "/F" parameter) what directory contains the symbolic link/junction. "Dir /F" will tell you the full path to a symbolic link/junction but not that it is a symbolic link/junction much less what the symbolic link/junction points to. "PDIr" iif any field selection parameters are supplied doesn't show what a symbolic link/junction points to and there is no field-selection parameter that I can see that gives you this information. So is there any way short of writing a program/batch file that I can get this information?
May 20, 2008
Syracuse, NY, USA
I don't know how thorough or accurate this is but ...
v:\> do j in /p dir /f /s /a:L c:\ ( echo %j = %@truename[%j] )
C:\Documents and Settings = C:\Users
C:\ProgramData\Application Data = C:\ProgramData
C:\ProgramData\Desktop = C:\Users\Public\Desktop
C:\ProgramData\Documents = C:\Users\Public\Documents
C:\ProgramData\Favorites = C:\Users\Public\Favorites
C:\ProgramData\Start Menu = C:\ProgramData\Microsoft\Windows\Start Menu
C:\ProgramData\Templates = C:\ProgramData\Microsoft\Windows\Templates
C:\Users\vefatica\Documents\My Music = C:\Users\vefatica\Music
C:\Users\vefatica\Documents\My Pictures = C:\Users\vefatica\Pictures
C:\Users\vefatica\Documents\My Videos = C:\Users\vefatica\Videos
May 24, 2010
Northlake, Il
Vince, that was close and it gave me an idea of how to do it in an even much simpler manner. To wit:
For /R Z:\. /D %D in (*) Do (If "%D" != "%@TrueName[%D]" Echo "%D" "%@TrueName[%D]")
Sample output for my "Z" drive (not really one of the one(s) I am interested in):
"Z:\Itune Movies" "C:\Users\Daniel Mathews\Music\iTunes\iTunes Media\Movies"
"Z:\Movies" "D:\iTunes Movies"
"Z:\Itune Movies\E.T. The Extra-Terrestrial" "C:\Users\Daniel Mathews\Music\iTunes\iTunes Media\Movies\E.T. The Extra-Terrestrial"
"Z:\Itune Movies\E.T. The Extra-Terrestrial - iTunes Extr" "C:\Users\Daniel Mathews\Music\iTunes\iTunes Media\Movies\E.T. The Extra-Terrestrial - iTunes Extr"
"Z:\Itune Movies\Ender's Game" "C:\Users\Daniel Mathews\Music\iTunes\iTunes Media\Movies\Ender's Game"
"Z:\Itune Movies\Ender's Game - iTunes Extras" "C:\Users\Daniel Mathews\Music\iTunes\iTunes Media\Movies\Ender's Game - iTunes Extras"
"Z:\LinkedFrom\LinkedTo" "\LinkedTo"
"Z:\Movies\E.T. The Extra-Terrestrial" "D:\iTunes Movies\E.T. The Extra-Terrestrial"
"Z:\Movies\E.T. The Extra-Terrestrial - iTunes Extr" "D:\iTunes Movies\E.T. The Extra-Terrestrial - iTunes Extr"
"Z:\Movies\Ender's Game" "D:\iTunes Movies\Ender's Game"
"Z:\Movies\Ender's Game - iTunes Extras" "D:\iTunes Movies\Ender's Game - iTunes Extras"
Thank you!
Similar threads
Thread starter Title Forum Replies Date
R How to? Use both TCC-RT and TCC on same PC Support 24
vefatica Both IFTP problems remain in build 50 Support 35
S WAD Close tcmd.exe with [x] and Windows 7 taskbar 'close window' both fail Support 2
M Just a verification regarding "Iff" and both "status test(s)" and "relational expression(s)"... Support 3
M How to? Handle errors in both a general and "complete" way... Support 6
Roedy Cannot have both v10 and v11 Support 7
vefatica Installing both v9 and v10 Support 1
V Set path permanently from within TCC? Support 3
Jay Sage Command Will Not Run Using Short Name of Path Support 5
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
D How to? Path problems in TCC20 Support 1
vefatica "COMSPEC path" Support 2
Patulus TCHistoryLog: TCC: (Sys) The system cannot find the path specified Support 15
vefatica If there's no PATH variable ... Support 5
D V19: toolbar /r "path\tctoolbar.ini" Support 1
C ECHOing the _CWD with a & in the path Support 7
David McClelland How to? Path Changes Support 4
gschizas Fixed Cannot use extended path to delete invalid file Support 3
nickles Fixed In batch files, %0 now evaluates to the absolute path Support 9
cgunhouse IFTP Path Issue in V17 - Fixed Support 7
M How to? List path getting short file and directory names... Support 10
N Command completion and PATH Support 0
noahcoad How to? Create shortcut with env var in path Support 4
Exolon Space within path and FOR Support 4
A WAD Dir daterange + multiple path wildcards crashes tcc Support 2
D TCC can't start app if @shfolder[42] used for path Support 1
fpefpe How to? Path(s) for Python Support 0
D TPIPE works without being in path, but not V; aemail Support 8
Stefano Piccardi IDE.exe start toobar button fails when % in script path Support 0
H 12.10 UNZIP ignores destination path spec Support 2
Phileosophos unzip not using specified path Support 5
D Extracting the current command line, extracting current path Support 4
Stefano Piccardi char class wildcard issue when [] in path Support 14
D Function to see if a UNC path is mapped? Support 9
williamleara Specifying path to TCMD.INI causes issues Support 8
hrensink Path length limit Support 9
CWBillow Adding to the path Support 6
D D:\Settings\Application contains an incorrect path? Support 0
M TCC cannot find the path specified Support 4
P Too much path in path Support 12
D When copying/moving, appending " (2)" to filename when the target file already exist. Support 7
A Installer /extract: extracts into current directory if target not exists Support 12
vefatica Job handle in target app Support 4
C Move /s sorce target Support 13
Phileosophos COPY /W does not delete files in the target Support 4
K iftp script copy deletes target files Support 17

Similar threads