AutoHotkey Community

It is currently May 26th, 2012, 2:15 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: April 3rd, 2008, 6:46 pm 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
Folder2Junction 1.0

Updated 2008/Apr/5

Requirements: Windows Vista or higher (uses mklink command which is new to Vista). Can be used only on NTFS disks.

Description: Moves a folder to a new location, then makes a NTFS junction in the folder's original location pointing to its new location. NTFS junctions are like wormholes in the file system. Folder2Junction was created so that it would be easier to move sensitive files to an encrypted disk (for example, using TrueCrypt) while keeping junctions in the files' original unencrypted location to maintain ease-of-access and compatibility with applications.

Screenshot:

Image

Cautions: Junction points are kind of a bizarre feature, and there may be strange or bad effects if used inappropriately. I encourage you to learn more about NTFS junctions before using this or similar utilities. Making junctions within junctions may be especially hazardous. Folder2Junction attempts a few safeguards: it will try to not let you move a "folder" that is already actually a junction; it will also refuse to move a folder to a location that already contains a folder of the same name; and it will verify the formation of a junction in the original location. If there is a problem with junction creation, Folder2Junction will ofter to move the folder back to its original location.

For more information about junctions and NTFS, there's a decent article on Wikipedia: http://en.wikipedia.org/wiki/NTFS_junction_point

For more on TrueCrypt (not affilated with Folder2Junction): http://www.truecrypt.org

Folder2Junction thread on the AutoHotkey forum: http://www.autohotkey.com/forum/topic30402.html

Acknowledgements: Created with AutoHotkey, Compile_AHK II, and Inno Setup, which are awesome. Icon is a squished version "Copy" by Kelli Shaver: http://DesignMagus.com Thanks too to converticon.com and IcoFX. Additional acknowledgements to Lexikos and many others on the AutoHotKey forum for teaching me about AHK, and to Hermann Schinagl for his Link Shell Extension and website that helped me learn more about hard links. If you want to do more with NTFS links or on earlier versions of NT-based Windows, his utility is very good and also free. Additional thanks to the makers of AutoHotkey and for providing autohotkey.net for hosting scripts like Folder2Junction. I'd like to also acknowledge all the software developers who make freeware; I've really appreciated it, and I'm glad I can for the first time contribute a freeware program of my own.

AutoHotkey: http://www.autohotkey.com
Compile_AHK II: http://www.autohotkey.com/forum/topic22975.html
Inno Setup: http://www.jrsoftware.org/isinfo.php
Link Shell Extension: http://schinagl.priv.at/nt/hardlinkshel ... llext.html

Download Setup

Source (Source is also included with the setup package)

This is my first utility for Windows ever! If you have any advice, please let me know. I hope this is useful to somebody.


Last edited by instantrunoff on April 7th, 2008, 1:15 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2008, 12:52 am 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
2008/April/5

Updated description and made script more robust. Changed version number to 1.0, because it does everything I want it to do and version 0.2 sounded too unfinished.

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2008, 1:16 am 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
download link fixed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2008, 1:29 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
This looks terrific (and well documented), but I am afraid of trying it in my main PC. I wait to see if others burn their fingers with it...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2008, 1:34 am 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
There is a tool in the win2000 powertools, you could include to add support for XP and 2000, or alternatively.

http://www.microsoft.com/technet/sysint ... ction.mspx

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2008, 1:58 am 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
Thanks for your support! About making it work on Windows XP/2000, I thought of employing Junction.exe by Sysinternals instead of the Vista-specific command mklink, but I was worried that people might have accidental deletes and the like too readily, because those versions of Windows, unlike Vista, do not have a junction-aware Explorer. Like I wrote here, when a junction is deleted in Vista's default shell, the target is untouched. Also, junctions in Vista have a telltale icon overlay, whereas they look identical to regular folders in XP. I believe that deleting a junction in Explorer under XP deletes the original folder.

The Link Shell Extension I mention above does have XP/2000 support, but the extension itself provides an icon overlay for pre-Vista Windows so the user can tell what's what. Further, the Link Shell Extension prevents accidental deletion:
Quote:
Junctions can be deleted by using the Delete commands from Explorer as usual, if Link Shell Extension is installed, because Link Shell Extension implements a so called CopyHook handler, which intercepts Explorers Delete commands, and thus fixes Explorers problems with junctions.


I'd be more willing to add support for XP/2000 if someone could help me figure out how to provide the icon overlay and a CopyHook handler like this other program, especially since Folder2Junction might be useful only to those now who have Vista without EFS (Home Basic and Home Premium) and are savvy enough to understand NTFS junctions.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 11:15 pm 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
this is your 'method':
Code:
RunWait, %comspec% /c mklink /j "%A_LoopFileName%" "%folderdestination%\%A_LoopFileName%", %A_LoopFileDir%



which obviously not work in XP, and could be done just by RUN direct from Vista....


just in case anyone actually works out DLL calls to actually CREATE junctions by AHK (vs. wrap command line).

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2009, 12:04 am 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
Joy2DWorld wrote:
this is your 'method':
Code:
RunWait, %comspec% /c mklink /j "%A_LoopFileName%" "%folderdestination%\%A_LoopFileName%", %A_LoopFileDir%



which obviously not work in XP, and could be done just by RUN direct from Vista....


just in case anyone actually works out DLL calls to actually CREATE junctions by AHK (vs. wrap command line).


Sorry you don't like it. Perhaps another software would be better suited for you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2009, 1:45 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
instantrunoff wrote:

Sorry you don't like it. Perhaps another software would be better suited for you.


not an issue of like. Looks very nice from the screenshot, and nothing wrong with your nice code.


Would be nice if there actually were some work on AHK Folder2Junction. You've done what looks like a super nice job of wrapping the command line (which is something AHK does great & obviously you took a lot of time etc.).


worth keeping clear what this is... Vista command line wrapper, essentially...

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2009, 2:09 am 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
This might interest you: http://www.autohotkey.com/forum/viewtop ... highlight=


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 15th, 2009, 2:28 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
http://www.totalcmd.net/plugring/ntfslinks.html

This program allows to create hard links and junctions on NTFS volumes

I am very happy with this program, I am using it for years. It works on each system I tried.

Although its among Total Commander utilities it can be used without it.

How to use it:
Code:
NtfsLinks.exe <ListOfFiles.txt> <DestinationFolder> /i=NL_Eng.ini


Each file in the list of files is on the separate line with full path.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 2:14 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
some cool stuff could be done with an AHK based control for junctions. Once had looked to do that, and realized was going to take way longer to build than had to devote to proj.

Was all excited that someone had actually been able to work thru all the web of steps and built an AHK junction box...

but alas,

command line wrapper for Vista....

such is life...

(somehow missed the "
Requirements: Windows Vista or higher (uses mklink command which is new to Vista). Can be used only on NTFS disks. " in description... sorry...)

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 2:18 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
instantrunoff wrote:


yes, nice.


but what about trying to figure out if a folder HAS a junction (vs. *is* a junction).

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2009, 9:26 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Junction point can be handled natively with AHK. Here is a quote of myself more than a year ago in the thread:
http://www.autohotkey.com/forum/topic22862-15.html
I wrote:
If Vista, I think you can use CreateSymbolicLink API, but I can't tell for sure as I have no access to Vista.
If other OS >= W2K, you have to use DeviceIoControl API with FSCTL_SET_REPARSE_POINT/FSCTL_GET_REPARSE_POINT/FSCTL_DELETE_REPARSE_POINT.

Here is a reference in MSDN:
http://msdn.microsoft.com/en-us/library/aa363948.aspx

Curiously no one seems to have tried implementing it. Or someone had tried but failed? I'd not be surprised to hear that as the MSDN documentation is incorrect or incomplete. However, all needed ones are already there, so it's just a matter of putting them properly.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group