zoukankan      html  css  js  c++  java
  • 云平台丢失文件的查找办法

    -- 测试环境
    10.10.14.159
    dsideal_db_duibi



    -- 创建表
    CREATE TABLE  IF NOT EXISTS `aaaa`  (
      `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL
    ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

    -- 清空表
    truncate table `aaaa`;

    -- 创建split函数
    CREATE FUNCTION SPLIT_STR(
      x VARCHAR(255),
      delim VARCHAR(12),
      pos INT
    )
    RETURNS VARCHAR(255)
    RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
           LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
           delim, '');


    -- 打开Navicat Premium,打开表aaaa,将数据粘贴上去


    -- 如果表存在,就删除掉
    drop table  if exists t_lost_thumbs;

    -- 创建正式表
    create table t_lost_thumbs (select split_str(`name`, ' ',1) as id,replace(`name`,concat(split_str(`name`, ' ',1),' ') ,'') as sname,(select substring_index(aaaa.name,'.',-1)) as ext from aaaa);

    -- 查看一下
    select * from t_lost_thumbs;

    -- 按文件名聚合统计一下
    select sname,count(*) as scount from t_lost_thumbs GROUP BY sname order by count(*) desc;

    -- 按扩展名聚合一下
    select ext ,count(*) as scount from t_lost_thumbs group by ext order by count(*) desc;


    --===============================================================================
    云资源总个数:2414510

    丢失缩略图个数:7715


    其中swf,mp4,ppt,wmv为主要丢失的类型,需要分别想办法进行丢失文件修复。
    swf    5167
    mp4    5163
    ppt    2695
    wmv    570
    flv    231
    jpg    189
    mpg    49
    asf    22
    png    6
    mpeg    3
    jpeg    1
    gif    1
    -- ================================================================================================================

    丢失的文件查找:


    -- 打开Navicat Premium,打开表aaaa,将数据粘贴上去

    -- 如果表存在,就删除掉
    drop table  if exists t_lost_files;

    -- 创建正式表
    create table t_lost_files (select split_str(`name`, ' ',1) as id,replace(`name`,concat(split_str(`name`, ' ',1),' ') ,'') as sname,(select substring_index(aaaa.name,'.',-1)) as ext from aaaa);

    -- 查看一下
    select * from t_lost_files;

    -- 按扩展名聚合一下
    select ext ,count(*) as scount from t_lost_files group by ext order by count(*) desc;

    ================================================================================================================

    测试用例 :


    http://video.edusoa.com/down/Material/19/1995C8C9-92DC-464B-BD3F-00AF45116CF6.wmv
    http://video.edusoa.com/down/Material/7B/7B91BBEB-7553-4359-BACD-2BBBF5988AD1.wmv
    http://video.edusoa.com/down/Material/77/77BF13EE-0BDD-B837-21D6-634501372BF9.swf
    http://video.edusoa.com/down/Material/28/28A98B04-0ECE-F21E-D147-A5D2573B05CD.swf
    http://video.edusoa.com/down/Material/01/01024397-BC36-4111-9B2B-9437F5A8DFEB.ppt
    http://video.edusoa.com/down/Material/7C/7CABD07E-EB50-46B1-8953-20A25EB6FD0C.mpg

  • 相关阅读:
    BZOJ 2212/BZOJ 3702
    BZOJ 4761 Cow Navigation
    BZOJ 3209 花神的数论题
    BZOJ 4760 Hoof, Paper, Scissors
    BZOJ 3620 似乎在梦中见过的样子
    BZOJ 3940 Censoring
    BZOJ 3942 Censoring
    BZOJ 3571 画框
    BZOJ 1937 最小生成树
    BZOJ 1058 报表统计
  • 原文地址:https://www.cnblogs.com/littlehb/p/9000803.html
Copyright © 2011-2022 走看看