| View previous topic :: View next topic |
| Author |
Message |
instantrunoff
Joined: 13 Jan 2008 Posts: 84
|
Posted: Thu Apr 03, 2008 6:46 pm Post subject: Folder2Junction: Moves Folder and Makes a NTFS Junction |
|
|
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:
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/hardlinkshellext/hardlinkshellext.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 Mon Apr 07, 2008 1:15 am; edited 2 times in total |
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 84
|
Posted: Sun Apr 06, 2008 12:52 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 84
|
Posted: Mon Apr 07, 2008 1:16 am Post subject: |
|
|
| download link fixed |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4425 Location: Pittsburgh
|
Posted: Mon Apr 07, 2008 1:29 am Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 1017 Location: London, UK
|
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 84
|
Posted: Mon Apr 07, 2008 1:58 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 485 Location: Galil, Israel
|
Posted: Wed Jan 14, 2009 11:15 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 84
|
Posted: Thu Jan 15, 2009 12:04 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 485 Location: Galil, Israel
|
Posted: Thu Jan 15, 2009 1:45 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 84
|
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3714 Location: Belgrade
|
Posted: Thu Jan 15, 2009 2:28 pm Post subject: |
|
|
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. _________________
 |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 485 Location: Galil, Israel
|
Posted: Fri Jan 16, 2009 2:14 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 485 Location: Galil, Israel
|
Posted: Fri Jan 16, 2009 2:18 am Post subject: |
|
|
yes, nice.
but what about trying to figure out if a folder HAS a junction (vs. *is* a junction). _________________ Joyce Jamce |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1776
|
Posted: Sat Jan 17, 2009 9:26 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|