0

So here's the scenario. I have a file torrent that gets updated and its so big its on a different disk, what I would like to do is create a link to where it would normally go if it wasn't so big and change the linked file name.

Example:

Directory\RealTorrentFile -> SymlinkedDirectory\ChangedNameTorrentFile

But have the ChangedNameTorrentFile point to the RealTorrentFile.

  • I realise a link can have A unique name, but I would be creating the link to all the files and then using FileBot FileRenamer to rename all the linked files, while keeping to original file name structure so it can be updated when its repackaged! Phr0stY :P – FreeSoftwareServers Aug 26 '15 at 5:33
  • While im not sure if this is a ability of FileBot, it seems it ended up renaming both linkes and original files when I tried a soft-link, im a weary of trying a Hard-Link as I am still unsure of the difference even after lots of reading – FreeSoftwareServers Aug 26 '15 at 5:49
  • A hard link cannot reside on a different drive. It is really two names for a file with the same inode. – Bruni Aug 26 '15 at 6:08
  • I always thought you could only hardlink inside same "file tree" aka OS, but its between same hard drives, even if linked inside same file tree - os? Nice to know, thanks, im closer to understanding Hard Links, I just always use Soft, never run into a reason to need to use Hard Links – FreeSoftwareServers Aug 26 '15 at 8:32
1

Ok, as you seem to have some trouble understanding links I'll start with a quick explanation:

Usually (depending on disk format) a file consists of two parts:

  1. On part holds the actual content of the file. It is anywhere on the disk.
  2. The other part is what you can see with any file explorer. This part does not hold any content but the location of the content on the disk. So this part is something like an entry-point to the actual file, which is anywhere else on your disk. (example: this is anyhow like an URL: a piece of information that points to the real content)

This only works inside one file system: There is no chance of having the second part pointing to another hard drive/partition or anything similar.
This is the reason why hard links can only be set inside one partition/hard drive.

What are hard links?

As explained above a file consists of two parts. A hard link is just another second part: The content stays always the same; but you have two entry points. So two files in your file explorer point to the exact same location on your disk. This is the reason why there is no "original file" anymore; they both are the same file. And hard-links can't be set to directories. Hard links are anyhow outdated. There are sometimes situations where you have to use those but they have some disadvantages that soft links don't have.

What are soft links?

Soft links are also called symbolic links or sym-links. They can be set to directories and even other partitions/hard drives! These are files with one purpose: Pointing to another file. But unlike hard links they are pointing not to the "content part" of the file but to the entry point. So the original file is still the unique original file but there is another file that points to it. This is the reason why soft links can be broken: they can point to a file that doesn't exist (anymore).


So the thing that you are looking for are soft links. You have two directories named /Directory/RealTorrentFile and /SymlinkedDirectory. You want to move RealTorrentFile from /Directory to /SymlinkedDirectory. (It's always a good idea to stop the torrent before you go on).

First move RealTorrentFile to /SymlinkedDirectory and rename it as you like:

mv -i /Directory/RealTorrentFile /SymlinkedDirectory/ChangedNameTorrentFileOrAnyOtherName

Then create a soft link in the origianl directory pointing to the new directory with the renamed file:

ln -s /SymlinkedDirectory/ChangedNameTorrentFileOrAnyOtherName /Directory/RealTorrentFile

Be aware that RealTorrentFile has to have the same name as the original torrent file. Otherwise your torrent would be very surprised that there is another file :)

So that's already it!
I hope everything got a little clearer about soft and hard links. If you have any further questions feel free to ask!

0

You can start your torrent, stop it, move the directory to the drive with more space and use ln -s to link between those:

ln -s /moar/space/CoolTorrent /torrent/download/dir/

Then start the torrent again and it will be saved in /moar/space/CoolTorrent.

  • yea its just a naming issue, torrents come with such garbage naming, I want to rename the linked files but keep the original torrent format for later – FreeSoftwareServers Aug 26 '15 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.