forked from likun7981/hlink
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
314 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,164 @@ | ||
# hlink | ||
|
||
待补充 | ||
## 基础用法 | ||
|
||
为`/path/to/source`目录下的所有满足要求的文件,创建硬链接输出到`/path/to/dest` | ||
|
||
无任何配置项的情况 **hlink** 默认会硬链常用的视频格式`mp4,flv,f4v,webm,m4v,mov,cpk,dirac,3gp,3g2,rm,rmvb,wmv,avi,asf,mpg,mpeg,mpe,vob,mkv,ram,qt,fli,flc,mod,iso` | ||
|
||
```zsh | ||
hlink /path/to/source /path/to/dest | ||
``` | ||
|
||
## 配置文件(推荐) | ||
|
||
作者推荐,使用配置文件来进行配置各个选项,这样配置可以持久化。命令使用也更简单,只需要`hlink -c /path/to/hlink.config.mjs`就可以完成硬链接生成 | ||
### 生成配置文件 | ||
|
||
使用以下命令 | ||
```bash | ||
hlink -g /path/to/outputDir | ||
``` | ||
如果没有指定`outputDir`,则默认**用户目录**生成。可以通过 `echo ~` 查看用户目录的具体路径 | ||
``` | ||
echo ~ | ||
/User/root | ||
``` | ||
|
||
### 使用配置文件 | ||
|
||
使用以下命令读取配置文件 | ||
```bash | ||
hlink -c /path/to/hlink.config.mjs | ||
``` | ||
如果没有指定`hlink.config.mjs`的路径,则默认会读取**用户目录**下面的`hlink.config.mjs` | ||
|
||
### 配置文件说明 | ||
|
||
通过 `vim ~/hlink.config.mjs`可以进行编辑,默认内容如下 | ||
```js | ||
// 重要说明路径地址都请填写 绝对路径!!!! | ||
export default { | ||
/** | ||
* 源地址 | ||
*/ | ||
source: '', | ||
/** | ||
* 目标地址 | ||
*/ | ||
dest: '', | ||
/** | ||
* 指定了该选项则是 白名单模式 | ||
* 该配置项优先级大于excludeExtname | ||
* 如果你需要使用excludeExtname请删除该配置项 | ||
*/ | ||
includeExtname: ['mp4', 'flv', 'f4v', 'webm', | ||
'm4v', 'mov', 'cpk', 'dirac', | ||
'3gp', '3g2', 'rm', 'rmvb', | ||
'wmv', 'avi', 'asf', 'mpg', | ||
'mpeg', 'mpe', 'vob', 'mkv', | ||
'ram', 'qt', 'fli', 'flc', 'mod', 'iso'], | ||
/** | ||
* 指定了该选项则是 黑名单模式 | ||
* 需要排除的后缀名, 如果配置了includeExtname则该配置无效 | ||
*/ | ||
excludeExtname: [], | ||
/** | ||
* 0:保持原有的目录结构 | ||
* 1:只保存一级目录结构 | ||
* 默认为 0 | ||
* 例子: | ||
* - 源地址目录为:/a | ||
* - 目标地址目录为: /d | ||
* - 链接的文件地址为 /a/b/c/z/y/mv.mkv; | ||
* 如果保存模式为0 生成的硬链地址为: /d/b/c/z/y/mv.mkv | ||
* 如果保存模式为1 生成的硬链地址为:/d/y/mv.mkv | ||
*/ | ||
saveMode: 0, | ||
/** | ||
* 是否打开缓存,默认关闭 | ||
* | ||
* 打开后,每次硬链后会把对应文件存入缓存,就算下次删除硬链,也不会进行硬链 | ||
*/ | ||
openCache: false, | ||
/** | ||
* 是否为独立文件创建同名文件夹,默认创建 | ||
*/ | ||
mkdirIfSingle: true, | ||
} | ||
``` | ||
|
||
::: warning 重要提醒 | ||
对于**威联通** root用户在生成机器重启后,用户目录会被还原,生成的配置文件会被清除。建议威联通用户不要用root用户,自建一个用户来使用 | ||
::: | ||
|
||
|
||
|
||
|
||
## 命令行指定配置 | ||
|
||
作者不推荐使用命令行直接指定选项,使用起来太麻烦,后续计划丢弃命令行直接指定配置选项。如果你有多个不一样的配置,可以使用`hlink -c /path/to/hlink.config.mjs`,来使用指定的配置文件 | ||
|
||
::: info 说明 | ||
命令行配置选项和配置文件配置选项里面同样的效果,如果在命令里面指定了配置选项,则**优先会读取配置选项的** | ||
::: | ||
|
||
|
||
### saveMode | ||
> 硬链的保存模式 | ||
可选值 | ||
* 0:保持原有的目录结构(这个是默认值) | ||
* 1:只保存一级目录结构 | ||
|
||
|
||
举例说明: | ||
* 源地址目录为 `/a` | ||
* 目标地址目录为 `/d` | ||
* 链接的文件地址为 `/a/b/c/z/y/mv.mkv` | ||
* 如果保存模式为0 生成的硬链地址为: `/d/b/c/z/y/mv.mkv` | ||
* 如果保存模式为1 生成的硬链地址为:`/d/y/mv.mkv` | ||
```bash | ||
hlink -s=1 /path/to/source /path/to/dest | ||
``` | ||
|
||
### includeExtname(即将废弃) | ||
> 同配置文件效果一样,唯一的区别是这里多项使用`,`隔开,配置文件为数组 | ||
白名单模式,需要包含的文件后缀,如果你需要使用黑名单模式,则不要指定该选项,同时需要删除配置文件中的`includeExtname`。 | ||
```bash | ||
hlink -i=mkv /path/to/source /path/to/dest | ||
``` | ||
|
||
### include(即将上线) | ||
> 替换includeExtname,使用场景更多,详情见[#issue12](https://github.com/likun7981/hlink/issues/12) | ||
### excludeExtname(即将废弃) | ||
> 与配置文件唯一的区别是这里多项使用`,`隔开,配置文件为数组 | ||
黑名单模式,需要排除的文件后缀,如果指定了`includeExtname`,则该配置无效。 | ||
```bash | ||
hlink -e=txt,info /path/to/source /path/to/dest | ||
``` | ||
### exclude(即将上线) | ||
> 替换excludeExtname,使用场景更多,详情见[#issue12](https://github.com/likun7981/hlink/issues/12) | ||
|
||
|
||
### openCache | ||
> 是否开启硬链缓存,默认不会开启 | ||
详细说下这个配置,这个配置与`hlink`的重复检测不是一个东西,希望大家不要误解。该配置的作用只有下面这样一个: | ||
|
||
比如某些保种的文件硬链到电影目录,但是你主动删除了电影目录硬链接,并且你下次不希望它再次被硬链过去,那么你就可以开启该配置项 | ||
|
||
```bash | ||
hlink -o /path/to/source /path/to/dest | ||
``` | ||
|
||
### mkdirIfSingle | ||
> 是否为独立文件创建同名文件夹,默认 会创建 | ||
```bash | ||
hlink -m=false /path/to/source /path/to/dest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,57 @@ | ||
|
||
::: tip 提醒 | ||
因为该命令会造成文件的删除,所以执行前,要检查清楚各项配置是否正确 | ||
::: | ||
# hlink prune | ||
|
||
## 说明 | ||
该命令翻译过来就是**修剪**,使用场景有以下两个 | ||
1. 正向:在源文件被删除了,但是硬链忘记删了。hlink可以帮你快速找到多余的硬链并删除 | ||
2. 反向:在硬链文件删除时,你希望能自动删除掉源文件(加计划任务) | ||
|
||
协助你同步管理硬链接和源文件。如果你还不清楚这个命令的作用,可以见[为什么会有prune命令?](../other/prune.md) | ||
|
||
## 举例 | ||
## 基础用法 | ||
|
||
比如你的源目录有 | ||
- download | ||
- download2 | ||
无任何配置项的情况 **hlink** 默认会检测常用的视频格式`mp4,flv,f4v,webm,m4v,mov,cpk,dirac,3gp,3g2,rm,rmvb,wmv,avi,asf,mpg,mpeg,mpe,vob,mkv,ram,qt,fli,flc,mod,iso` | ||
|
||
比如你的硬链目录有 | ||
- 电影 | ||
- 电视剧 | ||
- 动漫 | ||
多项路径,请使用`,`隔开。 | ||
|
||
硬链和源文件应该是一一对应的,如果所以你要这样使用该命令: | ||
::: warning 重要提醒 | ||
因为路径多项使用了`,`隔开,所以你的源路径和目标路径,一定不要包含`,`。否则会出错 | ||
::: | ||
|
||
1. 检查所有的硬链目录 | ||
```bash | ||
hlink prune /path/to/download,/path/to/download2 /path/to/电影,/path/to/电视剧,/path/to/动漫 | ||
hlink prune 源路径1,源路径2 目标路径1,目标路径2 | ||
``` | ||
|
||
当然你也可以 **检测部分硬链目录** 像下面这样 | ||
## 配置选项 | ||
|
||
2. 检测部分 | ||
### reverse | ||
是否使用反向检测,默认不使用反向检测,则为正向检测。该选项的使用场景是: | ||
|
||
```bash | ||
hlink /path/to/download,/path/to/download2 /path/to/电影 | ||
``` | ||
- 正向检测:**删除的是硬链目录的文件**,修剪硬链目录比源目录多的文件 | ||
- 反向检测:**删除的是源目录的文件**,修剪源目录比硬链目录多的文件。 | ||
|
||
因为 prune 的作用是 寻找 **源目录没有而硬链目录有的情况,所以我建议你源目录一定一定列全量**,否则可能存在下面的情况: | ||
::: warning 重要提醒 | ||
1. 正向检测:一定要列全所有的源目录 | ||
2. 反向检测:一定要列全所有的硬链目录 | ||
::: | ||
|
||
源目录1 -> 硬链目录1 | ||
源目录2 -> 硬链目录2 | ||
### includeExtname(即将废弃) | ||
> 多项使用`,`隔开 | ||
如果你这时候只告诉hlink 部分源目录,比如源目录1 | ||
白名单模式,需要包含的文件后缀,如果你需要使用黑名单模式,则不要指定该选项,同时需要删除配置文件中的`includeExtname`。 | ||
```bash | ||
hlink prune /path/to/源目录1 /path/to/硬链目录1,/path/to/硬链目录2 | ||
hlink prune -i=mkv /path/to/source /path/to/dest | ||
``` | ||
|
||
那这样造成的结果就会检测出来 **硬链目录2** 的文件,全部都找不到,全都会被修剪掉,因为它里面的文件全是从 **源目录2** 来的。 | ||
### include(即将上线) | ||
> 替换includeExtname,使用场景更多,详情见[#issue12](https://github.com/likun7981/hlink/issues/12) | ||
所以你自己无法确认对应关系,那么建议你 | ||
1. 使用正向检测时:**源目录一定一定要列全,硬链目录则可以随意** | ||
2. 使用反向检测时:**硬链目录一定一定要列全,源目录则可以随意** | ||
### excludeExtname(即将废弃) | ||
> 多项使用`,`隔开 | ||
更多使用配置可以见`hlink prune --help` | ||
|
||
注意点: | ||
- 因为我们采用 **,(英文逗号)** 来进行多项输入,所以你的路劲一定不要包含 **,(英文逗号)**。否则会导致未知错误,后果自负~ | ||
- 你自己无法确认对应关系,那么建议你 **源目录一定一定要列全,硬链目录则可以随意(至少一个)** | ||
- `includeExtname` 和 `excludeExtname` 建议和硬链时保持一致 | ||
黑名单模式,需要排除的文件后缀,如果指定了`includeExtname`,则该配置无效。 | ||
```bash | ||
hlink prune -e=txt,info /path/to/source /path/to/dest | ||
``` | ||
|
||
以上就是对 `hlink prune` 的所有介绍,有问题可以群里咨询 | ||
### exclude(即将上线) | ||
> 替换excludeExtname,使用场景更多,详情见[#issue12](https://github.com/likun7981/hlink/issues/12) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
执行以下命令即可完成安装 | ||
|
||
```bash | ||
$ npm i -g hlink | ||
npm i -g hlink | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
# 如何安装nodejs | ||
|
||
## 威联通 | ||
待补充 | ||
## 第一步、安装nvm | ||
|
||
## 群晖 | ||
待补充 | ||
```bash | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
``` | ||
|
||
## unraid | ||
待补充 | ||
## 第二步、使用`nvm`安装nodejs | ||
|
||
## Windows | ||
待补充 | ||
### 安装指定的nodejs版本 | ||
|
||
```bash | ||
# 安装最新的stable版本的nodejs | ||
nvm install stable | ||
|
||
# 或者你可以指定版本安装 | ||
nvm install 14 | ||
|
||
# 使用nvm查看已安装的包 | ||
nvm ls | ||
``` | ||
|
||
### 选项指定的node版本 | ||
|
||
```bash | ||
nvm use stable | ||
## 查看node是否安装成功 | ||
node -v | ||
``` | ||
|
||
::: warning 重要提醒 | ||
对于**威联通** root用户在生成机器重启后,用户目录会被还原,所有安装会被清除。建议威联通用户不要用root用户,自建一个用户来使用 | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
export default [ | ||
{ | ||
text: '威联通自动关联环境变量', | ||
text: '威联通用户必看', | ||
link: 'qnap' | ||
}, | ||
{ | ||
text: '如何贡献文档', | ||
link: 'contributing' | ||
}, | ||
{ | ||
text: '为什么有prune命令', | ||
link: 'prune' | ||
} | ||
] |
Oops, something went wrong.