工具链接:文件目录树查看器
引导页:引导页
你还在为找不到文件放在哪苦恼吗?你还在为电脑搜索文件慢焦躁吗?来试试咱的文件目录树查看器吧!
通过脚本生成文件目录数据,只需上传一次,便可愉快使用,光速检索文件。
Windows系统,.bat文件。直接双击运行,然后输入目录名。
@echo off
:: UTF-8
chcp 65001
@echo off
rem 设置文件根目录,后面不带换行,好像会不支持中文,沙雕东西
:: set "dirs=F:\相关文件夹"
rem set /p dirs=请输入目录路径:
set /p dirs=请输入所有目录路径(用空格分隔):
:: set "print=C:\Users\admin\Desktop\文件目录.txt"
:: 获取日期和时间
set "date=%DATE%"
set "time=%TIME%"
set "print=文件目录-%date:~3,4%-%date:~8,2%-%date:~11,2% %time:~0,2%-%time:~3,2%-%time:~6,2%.txt"
:: /a
:: 执行运算结果,并将结果赋值给变量
rem set /a "randomNumber=%RANDOM% * %RANDOM%"
rem set "print=文件目录-%randomNumber%.txt"
rem echo Directory listing for: %dirs%
rem dir "%dirs%"
:: /s
:: 指示 dir 命令递归地列出所有子目录。
:: /b
:: 以裸格式(仅文件名)列出文件。
:: /a-d
:: 不列出目录。但好像没什么卵用
:: /a-h
:: 不列出隐藏文件。
:: echo "%dirs%"
:: echo "%print%"
rem dir "%dirs%" /s /b /a-d /a-h > "%print%"
for %%i in (%dirs%) do (
if exist "%%~i" (
echo 目录: %%~i
dir "%%~i" /s /b /a-d /a-h >> "%print%"
) else (
echo 目录 %%~i 不存在,已跳过。
)
)
pause
Linux或Mac,.sh文件。打开终端,输入命令:
cd /User/xxx/xxx.sh # 通过cd命令,来到shell脚本所在目录
chmod +x xxx.sh # 赋予可执行的权限。执行过一次,后续可不用再赋权
./xxx.sh 目录名1 目录名2
#!/bin/bash
# 检查是否提供了目录参数
if [ $# -eq 0 ]; then
echo "使用方法: $0 <目录路径1> [目录路径2 ...]"
exit 1
fi
# 创建输出文件名(在当前目录下)
output_file="file_list.txt"
# 清空或创建输出文件
> "$output_file"
# 处理每个输入的目录
for directory in "$@"; do
# 检查提供的路径是否存在且是一个目录
if [ ! -d "$directory" ]; then
echo "警告: '$directory' 不是一个有效的目录,已跳过"
continue
fi
# 获取目录的绝对路径
abs_directory=$(cd "$directory" && pwd)
echo "正在处理目录: $abs_directory"
# 使用 find 命令列出所有文件(不包括目录)并追加到文件中
find "$abs_directory" -type f >> "$output_file"
done
# 对文件进行排序并去重
sort -u "$output_file" -o "$output_file"
echo "文件列表已保存到 $output_file"
echo "共处理了 $(wc -l < "$output_file") 个文件"
效果如图。可通过关键字,秒得想要的结果。使用了localStorage,可将目录数据存储在浏览器中,所以后续无需再上传目录数据。
鼠标移到文件节点上,会显示文件全路径。点击文件节点,可复制文件全路径。有了全路径,自然就可以轻松找到文件啦!