Copy real file from a shortcut preserving the time stamps and directory tree

I have directory with shorcuts of files.
for example:

gara@yn\short\name1 ( shortcut to gara@yn\FOLDER\OPT\GARA\1.jpg )
gara@yn\short\name2 ( shortcut to gara@yn\FOLDER\OPT\GARA\11.jpg )
gara@yn\short\name3 ( shortcut to gara@yn\MARA\URSA\2.jpg )
gara@yn\short\name4 ( shortcut to gara@yn\LUUM\OOO\TRY\3.jpg )

Is they are a way i can copy the real files by having only they are shortcuts in a specific folder (gara@yn\RESULT) preserving the directory structure of the file and keeping the time stamps ?

for example

gara@yn\RESULT\FOLDER\OPT\GARA\1.jpg
gara@yn\RESULT\FOLDER\OPT\GARA\11.jpg
gara@yn\RESULT\MARA\URSA\2.jpg )
gara@yn\RESULT\LUUM\OOO\TRY\3.jpg )

with presarved time stamps.

THX :wink:

ps: LOVE YOU ALL :stuck_out_tongue:

In windows, shortcuts files are stored as .lnk files. You may write a simple VB script using TargetPath function to get the target path of .lnk files and then proceed with further processing. IMHO, instead of the "Shell Programming and Scripting" forum, you may post this question in the Windows forum.

Well since i am posting here you should assume i am talking about linux not windows. I guess that C:\ made the wrong impression ^ ^.

BTW if it can`t be done assume i have a document file with the path of the files i need to copy:

gara@yn\FOLDER\OPT\GARA\1.jpg  
gara@yn\FOLDER\OPT\GARA\11.jpg  
gara@yn\MARA\URSA\2.jpg  
gara@yn\LUUM\OOO\TRY\3.jpg

Can this be copy like this:

gara@yn\omg\FOLDER\OPT\GARA\1.jpg  
gara@yn\omg\FOLDER\OPT\GARA\11.jpg  
gara@yn\omg\MARA\URSA\2.jpg  
gara@yn\omg\LUUM\OOO\TRY\3.jpg

with preserved date stamps ?

i wood really prefer if they are is a way to achieve the first task tho ( meening the one with the shorcuts )

ps: NEED to do this in LINUX if they are is still some sort of confusion :slight_smile:
ps2: windows SUX, LINUX ROKS \o/
ps3: I am still loving u all, if you wonna know how ... i just have extremely big hart :stuck_out_tongue:

Ah, the C:\blah\blah in your initial post gave an impression that it's windows. Anyway, there's a utility in linux - 'readlink' that does the trick.

# cat file_containing_soft_links_list.dat
gara@yn/short/name1
gara@yn/short/name2
gara@yn/short/name3
gara@yn/short/name4
#! /bin/bash

while read link
do
    target=$(readlink $link)
    processed=${target#*\\} # This will chop off "gara@yn/" from the beginning of target path
    processed=${processed%\\*} # This will chop off the file name from target path.
    cp --preserve=timestamps $target gara@yn/$processed # Copy with preserved timestamps
done < file_containing_soft_links_list.dat

I have readlink since i am with linux mint soo can someone pls tell me how to do the original task :o ?

Hope you're able to see the shell script in post #4 on your browser?

Now i am having problem with listing all shortcuts :confused:

find . -type f | sed "s#^.#$(pwd)#" 

work only for files not shortcuts

And btw part of the task is preserving the directory. Not sure if you sow that, because ( not sure ) don`t see where the directory has been copy