Dec-09-2024, 10:58 AM
(Dec-06-2024, 05:16 PM)snippsat Wrote:thanks, i was able to create folder of symlinks as shown in the image(Dec-05-2024, 10:18 AM)I3ordo Wrote: yes it does, but "a path" not paths, so if wanted to share 500 files of a folder that contains 5000 files, i will have to copy or move them to a different folder and feed that path to it however i just want to give 500paths to a torrent creation tool so it includes only those 500 filepaths instead of a single path...Something like this should work tested.
from pathlib import Path # Collect e.g filepaths.txt containing the full paths of the 500 files you want # I do no selection here just all files in this folder target_dir = Path(r"G:\div_code\foobar") output_file = Path("filepaths.txt") with output_file.open('w', encoding='utf-8') as f: # Iterate over all files in the directory (non-recursively) for item in target_dir.iterdir(): if item.is_file(): # Write the absolute path of the file f.write(f'{item.resolve()}\n')Below is an example of how to make a directory with symlinks fromfilepaths.txt
.
This allows you to point your torrent creation tool at this new directory,which will effectively include only the files you specify.
from pathlib import Path # The directory where you want to place your symlinks new_dir = Path(r"G:\div_code\foobar\file_out") input_file = Path("filepaths.txt") # Ensure the target directory exists new_dir.mkdir(parents=True, exist_ok=True) # Read the list of desired file paths with input_file.open('r') as f: for line in f: original_path_str = line.strip() if not original_path_str: continue original_path = Path(original_path_str) link_path = new_dir / original_path.name # Create a symbolic link if it doesn't already exist # If the link path already exists, consider removing it or handling it if not link_path.exists(): link_path.symlink_to(original_path) print(f"All selected files have been linked in {new_dir}.")A symbolic link (often called a symlink) is a type of file that points to another file or directory,much like a shortcut.
Instead of containing actual file data, a symlink simply holds a reference (a path) to another file system object.
In essence, a symlink is a convenient reference mechanism that helps organize,
share, and manage files and directories more flexibly without redundant data storage.
![[Image: ad.jpg]](https://img.eselt.de/img/16804274_721UCO1U2v1R0YBi/ad.jpg)
I can open the files view them , the rar files but they are 0kb and have .symlink extensions. I even renamed the extension from .symlink to .syml and the properties still recognize it as .symlink so it is a symlink but if i try to create a torrent of that folder, both mktorrent or libtorrent gives an error.
Tried qbittorrent's torrent creator tool that uses libtorrent, the reason for error is invalidlenght of torrent.
so it seems, torrent creatores are not compatible with symlinks...