g_BonE Posted January 27, 2008 Share Posted January 27, 2008 hi there,i know i can create a NTFS junction via:If Not FileExists('C:\test1junc\') Then MsgBox(0, "", FileCreateNTFSLink("C:\test1\", "C:\test1junc\"),1) EndIfnow, how can i remove this junction ? If usingt FileDelete() i end up deleting both the folders (junction and source) , also overwriting the junction with an empty target wont work.Regards,g_ ...Fenster fährt mich Nüsse... Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 28, 2008 Share Posted January 28, 2008 hi there, i know i can create a NTFS junction via: If Not FileExists('C:\test1junc\') Then MsgBox(0, "", FileCreateNTFSLink("C:\test1\", "C:\test1junc\"),1) EndIf now, how can i remove this junction ? If usingt FileDelete() i end up deleting both the folders (junction and source) , also overwriting the junction with an empty target wont work. Regards, g_ Since it is a directory link, you can use DirRemove(), but DON'T USE THE RECURSE FLAG: ; Note it is critical to NOT recurse! DirRemove("C:\test1junc\", 0) Another thing is this can confuse an open instance of Explorer. It may continue to show invalid paths in the destination. Closing it and reopening a new instance of Explorer should resolve it. Links to a file are easier, just FileDelete() the destination (not the source), and the link is gone. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now