Can you make .lnk file date same as its target
Moderators: Hacker, petermad, Stefan2, white
sorcar,
Eh, you could have mentioned that before.
HTH
Roman
Eh, you could have mentioned that before.

Code: Select all
Loop, Read, %1%
{
FileGetAttrib, Attrib, %A_LoopReadLine%
IfInString, Attrib, D
{
RegExMatch(A_LoopReadLine, ".*\\\K.*?(?=\\)", TopDirName)
StringLen, SourceAbsolutePathLength, A_LoopReadLine
SourceAbsolutePathLength--
Loop, Files, %A_LoopReadLine%*.*, R
{
SplitPath, A_LoopFileLongPath, , SourceSubDirPath, , FileName
StringTrimLeft, TargetSubDirPath, SourceSubDirPath, SourceAbsolutePathLength
FileGetTime, TimeStamp, %A_LoopFileLongPath%
FileCreateDir, %2%%TopDirName%%TargetSubDirPath%
FileCreateShortcut, %A_LoopFileLongPath%, %2%%TopDirName%%TargetSubDirPath%\%FileName%.lnk
FileSetTime, %TimeStamp%, %2%%TopDirName%%TargetSubDirPath%\%FileName%.lnk
}
Continue
}
SplitPath, A_LoopReadLine, , , , FileName
FileGetTime, TimeStamp, %A_LoopReadLine%
FileCreateShortcut, %A_LoopReadLine%, %2%%FileName%.lnk
FileSetTime, %TimeStamp%, %2%%FileName%.lnk
}
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Code works.
I was a little unsure if that would be possible. But it works so wonderfully!Eh, you could have mentioned that before.
Just show me one more thing. What change do I make to have filename.ext.lnk instead of filename.lnk. Both flavors (with or without extension) are useful.
sorcar,
Replace %FileName% with %FileNameWithExt% in all four FileSetTime and FileCreateShortcut lines as necessary.
HTH
Roman
Code: Select all
Loop, Read, %1%
{
FileGetAttrib, Attrib, %A_LoopReadLine%
IfInString, Attrib, D
{
RegExMatch(A_LoopReadLine, ".*\\\K.*?(?=\\)", TopDirName)
StringLen, SourceAbsolutePathLength, A_LoopReadLine
SourceAbsolutePathLength--
Loop, Files, %A_LoopReadLine%*.*, R
{
SplitPath, A_LoopFileLongPath, FileNameWithExt, SourceSubDirPath, , FileName
StringTrimLeft, TargetSubDirPath, SourceSubDirPath, SourceAbsolutePathLength
FileGetTime, TimeStamp, %A_LoopFileLongPath%
FileCreateDir, %2%%TopDirName%%TargetSubDirPath%
FileCreateShortcut, %A_LoopFileLongPath%, %2%%TopDirName%%TargetSubDirPath%\%FileName%.lnk
FileSetTime, %TimeStamp%, %2%%TopDirName%%TargetSubDirPath%\%FileName%.lnk
}
Continue
}
SplitPath, A_LoopReadLine, FileNameWithExt, , , FileName
FileGetTime, TimeStamp, %A_LoopReadLine%
FileCreateShortcut, %A_LoopReadLine%, %2%%FileName%.lnk
FileSetTime, %TimeStamp%, %2%%FileName%.lnk
}
HTH
Roman
Last edited by Hacker on 2016-06-13, 16:44 UTC, edited 1 time in total.
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Worked nicely after making all four replacement at FileSetTime and FileCreateShortcut.
You may like to post the script at http://www.ghisler.ch/wiki/index.php/AutoHotkey
Thanks Roman. It is quite helpful for my work.
You may like to post the script at http://www.ghisler.ch/wiki/index.php/AutoHotkey
Thanks Roman. It is quite helpful for my work.
sorcar,

Roman
Darn, my mistake, thanks for noticing.FileSetTime
Done.You may like to post the script at http://www.ghisler.ch/wiki/index.php/AutoHotke
You are welcome.Thanks Roman. It is quite helpful for my work.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.