LINKTODIRS(1)

πŸ“¦ version 3.5.2, in nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

ok so bestie, real talk: this is LINKTODIRS(1), from the User Contributed Perl Documentation section. Yes, it's a Perl script. No, don't run. She's iconic. πŸͺ✨


✨ NAME ✨

linkToDirs.pl β€” hard links files in directories with others. literally that's the whole vibe. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

        linkToDirs.pl [--linkWith copyBackupDir] [--linkWith ...]
                      --targetDir targetForSourceDir
                      [--progressReport number[,timeframe]]
                       [--printDepth] [--dontLinkSymlinks]
                      [--ignoreErrors] [--saveRAM] [-T tmpdir]
                      [--createSparseFiles [--blockSize]]
                      [--maxHardLinks]
                      sourceDir ...

🌸 DESCRIPTION 🌸

okay so here's the tea: this script makes a de-duplicated copy of the files in one directory over to another location. It utilizes hard links to the full extent possible so you don't waste storage space. no cap, that's the whole point. πŸ’…

Usage note (read this one, it's giving main character energy): most file copy utilities have just two primary parameters β€” the source and the destination. linkToDirs.pl said "not me being different" and gives you three:

  • source (sourceDir) πŸ“‚
  • destination (targetDir) 🎯
  • and a reference location (linkWith, optional) πŸ”—

The reference location is the place to look for existing content that can be hard linked to. And files that have the same contents in sourceDir? They get hard linked always in targetDir. always always. periodt. πŸ‘‘


πŸ”₯ OPTIONS πŸ”₯

  • --linkWith, -w β€” linkWith target; this is the backup spot where other backups have to be linked to. use this parameter multiple times for multiple directories. iykyk, stack 'em. if you do not use this option, the program will just copy and link sourceDir. simple as that. 🫢
  • --targetDir, -t β€” path(s) to the directory where the backups specified by --sourceDir should be placed. that's the destination bestie. 🎯
  • --progressReport, -P β€” print a progress report after each number of files. bonus: you may also add a time frame, after which a message is printed. so if you want a report every 1000 files and after one minute and 10 seconds, use: -P 1000,1m10s. obsessed with the flexibility honestly. ⏱️
  • --printDepth, -D β€” print the depth of the actual directory being read during the backup. for the girlies who like to know where they are in the tree. 🌳
  • --dontLinkSymlinks β€” do not hard link identical symbolic links. that's it. that's the flag. πŸͺž
  • --ignoreErrors, -i β€” if set, don't stop in case of errors when copying. bold. fearless. risky. πŸ’€
  • --saveRAM β€” write temporary dbm files in --tmpdir. use this if you do not have enough RAM. lowkey a lifesaver when your machine is fighting for its life. 😭
  • --tmpdir, -T β€” directory for temporary files; the default is </tmp>. πŸ—‚οΈ
  • --createSparseFiles, -s β€” if a file is indicated as a sparse file and that file has to be copied, then the external program cp gets called to copy that file. (gnucp / linux does some inspection about sparse files β€” so if your OS-related version of cp does not support this functionality, then this option will not work for you. sorry bestie, that's just how it is.) 🧚
  • --blockSize β€” block size used to check if a file is / may be a sparse file. default is 512 bytes, which should be fine for most file systems. πŸ’–
  • sourceDir β€” path(s) to directories which have to be linked to other backups. use this parameter multiple times for multiple directories. go off. πŸ“š
  • --maxHardLinks β€” maximum number of hard links to use. zero (which is the default) means the limit depends on the file system used only. πŸŽ€

Copyright (c) 2012-2022 by Heinz-Josef Claes (see README). Published under the GNU General Public License v3 or any later version.


🌈 okay that's the whole page, you ate that. go make some hard links, bestie. πŸ¦‹πŸ’œ

sign-off szn: this glorious page came to you courtesy of perl v5.34.0, dated 2022-03-20 β€” and it's LINKTODIRS(1) in case you forgot already πŸ˜ŒπŸ’…βœ¨

πŸ“¦ where this page comes from