AutoHotkey Community

It is currently May 27th, 2012, 9:19 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Create HardLinks
PostPosted: December 18th, 2011, 6:05 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Hard Links:
A hard link is the file system representation of a file by which more than one path references a single file in the same volume.
Establishes a hard link between an existing file and a new file. This function is only supported on the NTFS file ;system, and only for files, not directories.

For more information see MSDN HardLink.
Code:
HardLink(InFile,OutFile) {
Return (DllCall( "CreateHardLink", Str,outfile,Str,infile,Int,0))
}
Example
Code:
in = C:\Test\File.txt
out = C:\Test\File2.txt
hardlink(in,out) ;create a new file that is realy just another pointer to the same location


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2011, 8:44 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
Hi None,

I read the info at the link you provided and I'm as confused as ever. :cry:

I do understand that this makes a directory entry that "points" to a file.
That way you can have a links in multiple directories that "share" the file.

One benefit is that you can obfuscate or perhaps simplify the path to the file.
But other than this, I don't understand is the underlying purpose.

Can you give a few situation of how it might help?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2011, 10:52 am 
you can use it to point dropbox to a file that cannot be. placed in the dropbox folder as an example


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2011, 7:16 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
This could be useful if you are using version control you could put all the files in a single folder and still have them where you need them (the task for which I researched this topic).
If you need identical files in several folders you can save hard disk space by making them links.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2011, 5:42 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
@None

>>This could be useful if you are using version control you could put all the files in a single folder and still have them where you need them

Wouldn't the hardlink allow modifying the the file and therefore nullify "version control" ?

@Guest

>>you can use it to point dropbox to a file that cannot be. placed in the dropbox folder as an example

Hmm, I have recently been using "dropbox".
Can you give an example of what files can't be "dropped" ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2011, 4:54 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Leef_me wrote:
Wouldn't the hardlink allow modifying the the file and therefore nullify "version control" ?
If I ment just a copy of the files in another folder you would be correct, but I was thinking more in terms of a git repository where it is easier if all the files are in one place.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2011, 6:02 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
Leef_me wrote:
But other than this, I don't understand is the underlying purpose.
Can you give a few situation of how it might help?


Links are useful when you need files organized more than one way. For instance, you might invoice documents organized in a directory structure like this:

docs
|_ client A
|_ client B
|_ client C

but at the end of the month or quarter when your putting together tax or financial statements, it might be handy if you had the invoices organized like this:

docs
|_ Jan
|_ Feb
|_ Mar

With hard links, you can maintain the organization of both directory structures simultaneously. The file is stored only once physically despite the fact that you can access it via multiple directory paths.

EDIT: Removed a level of nesting since the padding was getting stripped off.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2011, 7:43 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
Hi wtg,

Thanks for your reply.

>>EDIT: Removed a level of nesting since the padding was getting stripped off.

That is caused by the bbs software. If you wrap your text in code tags, spaces and tabs are preserved; quotes don't help.

For example:

Code:
123456789012345678901234567890123456789012345678901234567890
eight spaces        <----
  one tab   <---
123456789012345678901234567890123456789012345678901234567890



Quote:
123456789012345678901234567890123456789012345678901234567890
eight spaces <----
one tab <---
123456789012345678901234567890123456789012345678901234567890


123456789012345678901234567890123456789012345678901234567890
eight spaces <----
one tab <---
123456789012345678901234567890123456789012345678901234567890

Btw, you can't type a tab into the webpage, but you can into notepad and then copy/paste.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2011, 10:35 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
You can also insert NBSP's -- non-breaking spaces -- with Alt+255 on NumPad. These are not "condensed," even without code tags.

While your remark about the forum software stripping spaces may be correct, it should not be the cause of blame: it is part of the HTML standard (IIRC) that multiplespaces are condensed. This allows for source formatting.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2011, 1:04 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
I'll blame anybody I want :!: :twisted: :wink:

Thanks for the info on NBSP's :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2011, 7:20 pm 
Offline

Joined: July 25th, 2006, 9:06 am
Posts: 51
Very useful, I have always thought this function could be used to cut down on copies of files around the hard drive. e.g. in a dupklicate finder program.
Thanks
Peterm


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Rajat, SKAN and 9 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