百度网盘文件自动分类sql 并带有对应标识图标

本文提供了一套完整的SQL脚本,用于自动分类文件系统中的各类文件,包括但不限于视频、音频、图片、文档等,并提供了PHP脚本实现定时自动执行这些SQL命令的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

效果:http://wjsou.com/

文件自动分类sql

update file set type='1' where category='-1'; -- 其它云文件
update file set type='3' where category='1'; -- 视频
update file set type='5'  where type='2'; -- 音频
update file set type='7' where category='3'; -- 图片
update file set type='9' where category='4'; -- 文档
update file set type='11' where category='5'; -- 软件
update file set type='1' where category='6'; -- 云
update file set type='16' where category='7'; -- 种子


update file set type='3' where filename like '%.mp4'; -- 视频
update file set type='3' where filename like '%.avi'; -- 视频
update file set type='3' where filename like '%.rmvb'; -- 视频
update file set type='3' where filename like '%.flv'; -- 视频
update file set type='3' where filename like '%.mkv'; -- 视频
update file set type='3' where filename like '%.flv'; -- 视频
update file set type='5' where filename like '%.mp3'; -- 音频
update file set type='7' where filename like '%.jpg'; -- 图片
update file set type='9' where filename like '%.txt'; -- 文档
update file set type='9' where filename like '%.pdf'; -- 文档
update file set type='9' where filename like '%.mobi'; -- 文档
update file set type='9' where filename like '%.doc'; -- 文档
update file set type='9' where filename like '%.docx'; -- 文档
update file set type='9' where filename like '%.wps'; -- 文档
update file set type='9' where filename like '%.ppt'; -- 文档
update file set type='9' where filename like '%.xls'; -- 文档
update file set type='9' where filename like '%.xlsx'; -- 文档
update file set type='9' where filename like '%.epub'; -- 文档
update file set type='9' where filename like '%.rtf'; -- 文档
update file set type='11' where filename like '%.exe'; -- 软件
update file set type='16' where filename like '%.torrent'; -- 种子


update file set type='13' where filename like '%.dmg'; -- 压缩包
update file set type='13' where filename like '%.GHO'; -- 压缩包
update file set type='13' where filename like '%.iso'; -- 压缩包
update file set type='13' where filename like '%.zip'; -- 压缩包
update file set type='13' where filename like '%.rar'; -- 压缩包
update file set type='13' where filename like '%.7z'; -- 压缩包
update file set type='14' where size='1024'; -- 文件夹
update file set type='0' where size='专辑'; -- 专辑
update file set type='12' where category is null; -- 手动添加的
update file set type='4' where size like '%个'; -- 多个文件






select category,count(*) from file group by category; -- 分类统计
select * from file where category is null limit 1000;
select * from file where type='6' limit 1000;
select type,count(*) from file group by type; -- 分类统计


select * from file where Id>7527035 and type='6' limit 1000;
select type,count(*) from file where Id>7527035 group by type;  -- 分类统计


php自动执行

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	</head>

<body>
<?php
set_time_limit(0);
//载入配置文件	
	require_once 'db.php';
	echo  '<br>正在整理分类文件';	
echo "<br>".mysql_query("update file set type='1' where category='-1'"); // 其它云文件
echo "<br>".mysql_query("update file set type='3' where category='1'"); // 视频
echo "<br>".mysql_query("update file set type='5'  where type='2'"); // 音频
echo "<br>".mysql_query("update file set type='7' where category='3'"); // 图片
echo "<br>".mysql_query("update file set type='9' where category='4'"); // 文档
echo "<br>".mysql_query("update file set type='11' where category='5'"); // 软件
echo "<br>".mysql_query("update file set type='1' where category='6'"); // 云
echo "<br>".mysql_query("update file set type='16' where category='7'"); // 种子
echo "<br>".mysql_query("update file set type='3' where filename like '%.mp4'"); // 视频
echo "<br>".mysql_query("update file set type='3' where filename like '%.avi'"); // 视频
echo "<br>".mysql_query("update file set type='3' where filename like '%.rmvb'"); // 视频
echo "<br>".mysql_query("update file set type='3' where filename like '%.flv'"); // 视频
echo "<br>".mysql_query("update file set type='3' where filename like '%.mkv'"); // 视频
echo "<br>".mysql_query("update file set type='3' where filename like '%.flv'"); // 视频
echo "<br>".mysql_query("update file set type='5' where filename like '%.mp3'"); // 音频
echo "<br>".mysql_query("update file set type='7' where filename like '%.jpg'"); // 图片
echo "<br>".mysql_query("update file set type='9' where filename like '%.txt'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.pdf'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.mobi'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.doc'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.docx'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.wps'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.ppt'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.xls'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.xlsx'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.epub'"); // 文档
echo "<br>".mysql_query("update file set type='9' where filename like '%.rtf'"); // 文档
echo "<br>".mysql_query("update file set type='11' where filename like '%.exe'"); // 软件
echo "<br>".mysql_query("update file set type='16' where filename like '%.torrent'"); // 种子
echo "<br>".mysql_query("update file set type='13' where filename like '%.dmg'"); // 压缩包
echo "<br>".mysql_query("update file set type='13' where filename like '%.GHO'"); // 压缩包
echo "<br>".mysql_query("update file set type='13' where filename like '%.iso'"); // 压缩包
echo "<br>".mysql_query("update file set type='13' where filename like '%.zip'"); // 压缩包
echo "<br>".mysql_query("update file set type='13' where filename like '%.rar'"); // 压缩包
echo "<br>".mysql_query("update file set type='13' where filename like '%.7z'"); // 压缩包
echo "<br>".mysql_query("update file set type='14' where size='1024'"); // 文件夹
echo "<br>".mysql_query("update file set type='0' where size='专辑'"); // 专辑
echo "<br>".mysql_query("update file set type='12' where category is null"); // 手动添加的
echo "<br>".mysql_query("update file set type='4' where size like '%个'"); // 多个文件

echo  '<br>整理完成。当前时间:'.date('Y-m-d H:i:s');










/* 注释内容
0 .x6     专辑
1 .icon   云
2 .icon01 Excel
3 .icon10 视频
4 .icon12 多个文件
5 .icon20 音频
6 .icon22 x
7 .icon30 图片
8 .icon32 x
9 .icon40 文档
10.icon42 x
11.icon50 软件
12.icon52 其它
13.icon60 压缩包
14.icon61 文件夹
15.icon62 x
16.icon70 种子
17.icon72 x

$typeArray=array("x6","icon","icon01","icon10","icon12","icon20","icon22","icon30","icon32","icon40","icon42","icon50","icon52","icon60","icon61","icon62","icon70","icon72");  //-1 全部 1视频 2音乐 3图片 4程序 5其它 6种子

update file set type='1' where category='-1'; -- 其它云文件
update file set type='3' where category='1'; -- 视频
update file set type='5'  where type='2'; -- 音频
update file set type='7' where category='3'; -- 图片
update file set type='9' where category='4'; -- 文档
update file set type='11' where category='5'; -- 软件
update file set type='1' where category='6'; -- 云
update file set type='16' where category='7'; -- 种子

update file set type='3' where filename like '%.mp4'; -- 视频
update file set type='3' where filename like '%.avi'; -- 视频
update file set type='3' where filename like '%.rmvb'; -- 视频
update file set type='3' where filename like '%.flv'; -- 视频
update file set type='3' where filename like '%.mkv'; -- 视频
update file set type='3' where filename like '%.flv'; -- 视频
update file set type='5' where filename like '%.mp3'; -- 音频
update file set type='7' where filename like '%.jpg'; -- 图片
update file set type='9' where filename like '%.txt'; -- 文档
update file set type='9' where filename like '%.pdf'; -- 文档
update file set type='9' where filename like '%.mobi'; -- 文档
update file set type='9' where filename like '%.doc'; -- 文档
update file set type='9' where filename like '%.docx'; -- 文档
update file set type='9' where filename like '%.wps'; -- 文档
update file set type='9' where filename like '%.ppt'; -- 文档
update file set type='9' where filename like '%.xls'; -- 文档
update file set type='9' where filename like '%.xlsx'; -- 文档
update file set type='9' where filename like '%.epub'; -- 文档
update file set type='9' where filename like '%.rtf'; -- 文档
update file set type='11' where filename like '%.exe'; -- 软件
update file set type='16' where filename like '%.torrent'; -- 种子

update file set type='13' where filename like '%.dmg'; -- 压缩包
update file set type='13' where filename like '%.GHO'; -- 压缩包
update file set type='13' where filename like '%.iso'; -- 压缩包
update file set type='13' where filename like '%.zip'; -- 压缩包
update file set type='13' where filename like '%.rar'; -- 压缩包
update file set type='13' where filename like '%.7z'; -- 压缩包
update file set type='14' where size='1024'; -- 文件夹
update file set type='0' where size='专辑'; -- 专辑
update file set type='12' where category is null; -- 手动添加的
update file set type='4' where size like '%个'; -- 多个文件



select category,count(*) from file group by category; -- 分类统计
select * from file where category is null limit 1000;
select * from file where type='6' limit 1000;
select type,count(*) from file group by type; -- 分类统计

select * from file where Id>7527035 and type='6' limit 1000;
select type,count(*) from file where Id>7527035 group by type;  -- 分类统计
*/
?>				
</body>
</html>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小黄人软件

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值