LINKTODIRS(1)
π linkToDirs.pl β the hard-link slay π
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 linksourceDir. simple as that. π«Ά--targetDir,-tβ path(s) to the directory where the backups specified by--sourceDirshould 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 programcpgets called to copy that file. (gnucp / linux does some inspection about sparse files β so if your OS-related version ofcpdoes 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 is512bytes, 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 π
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
- nixos 26.05: store-backup 3.5.2
- nixpkgs unstable: storebackup 3.5.2
- opensuse-leap 16.0: storeBackup 3.5.2-bp160.1.9 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms