This may be a feature request in disguise...
Is there a way to get hazel to hard link a file instead of copying or moving it? This would serve to prevent hazel from borking torrent seeding when it does the rest of its magic.
Moderator: Mr_Noodle
tiny-e wrote:Seeing as you can't hard link folders (I think), I would need to figure out a way to tell it via applescript or shell script to "mirror" the folder (if the torrent contains one) and its contents via hard linking on an individual basis.
tiny-e wrote:Not really sure how to do this, how to pass the file or folder names/paths from hazel to the script.
ln -s "$1" /absolute/path/to/directory/where/your/other/script/can/run/
tiny-e wrote:I'm kinda following an example (the other script that renames the files).
tiny-e wrote:Assuming the reason would be that hard linking allows the same file to be in two different places with 2 different names without breaking the torrents seeding.
tiny-e wrote:The guts of the script are protected if I remember correctly.
tiny-e wrote:I believe symbolic links break seeding in Transmission.
tiny-e wrote:Couldn't I use your example from before and just make the 'ln' part a hard link?
import os;
import sys;
import subprocess;
# replace the path in between the quotes with the folder where you want folders to end up
destinationPath = "/absolute/path/to/destination/";
sourcePathLength = len(sys.argv[1]);
for current, directories, files in os.walk(sys.argv[1]):
currentDestination = os.path.join(destinationPath, current[sourcePathLength:]);
if not os.path.exists(currentDestination):
os.mkdir(currentDestination);
for item in files:
subprocess.Popen(["ln", os.path.join(current, item), os.path.join(currentDestination, item)], stdout = subprocess.PIPE);
#include <unistd.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
if (argc != 3)
return 1;
int ret = link(argv[1], argv[2]);
if (ret != 0)
perror("link");
return ret;
}
cd ~/Desktop
gcc -o hlink hlink.c -Wall
chmod 755 hlink