乱码三千 – 分享实用IT技术

乱码三千 – 码出一个新世界


  • 首页

  • 归档

  • 搜索

img标签随机获取高质量图片

发表于 2022-07-09

起因

博主打算为自己在vps上挂载的服务, 建立一个导航页, 于是写一个静态页面, 贴了几个超链接

后来, 感觉不美观, 就放了几张图片

服务器存储的图片看了几遍就看腻了, 于是找了一个高质量图片的api, 每次打开导航页都能看到随机的封面

开源图片api的使用

  • 我想获得300*300, 关于book和library的图片”

    1
    https://source.unsplash.com/300x300/?book,library
  • 将随机图片嵌入到html中

    1
    <img src="https://source.unsplash.com/300x300/?book,library">

随机封面效果展示

  • 第一次打开:

img

  • 第二次打开

img

  • 第三次打开

img

  • 第N次打开…

img

随机封面测试地址(页面每次刷新,都能看到不同的封面)

页面部分源码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<body>
<section class="clearfix">
<div class="item">
<a href="http://git.zhaoolee.com">
<img src="https://source.unsplash.com/300x300/?program" alt="">
<div class="item-title">私有Git仓库</div>
</a>
</div>


<div class="item">
<a href="http://cloud.zhaoolee.com">
<img src="https://source.unsplash.com/300x300/?document" alt="">
<div class="item-title">私有云网盘</div>
</a>
</div>

<div class="item">
<a href="https://www.jianshu.com/u/c5d047065c42">
<img src="https://source.unsplash.com/300x300/?book,library" alt="">
<div class="item-title">简书主页</div>
</a>
</div>

<div class="item">
<a href="https://github.com/zhaoolee">
<img src="https://source.unsplash.com/300x300/?github" alt="">
<div class="item-title">Github主页</div>
</a>
</div>

<div class="item">
<a href="">
<img src="https://source.unsplash.com/300x300/?cartoon" alt="">
<div class="item-title">在线爬虫(建设中)</div>
</a>
</div>


<div class="item">
<a href="">
<img src="https://source.unsplash.com/300x300/?beauty" alt="">
<div class="item-title">资源分享(建设中)</div>
</a>
</div>
</section>
</body>

小结:

  • 使用随机化开源图片封面, 能让我们每次打开页面都有惊喜.
  • 对于刚刚接触前端的小伙伴, 使用开源的图片库, 能让你的页面更加丰富多彩, 提升学习的兴趣.
  • 对于前端老司机,可以获取定制化的开源图片, 提升页面展示效果.
  • 如果你对图片的质量有极致的追求,https://source.unsplash.com 提供了丰富的接口参数设置,可以定制化随机图片的范围, 当然也可以在unsplash.com 注册一个账号, 订阅特别主题的图片

本文转载自: https://cloud.tencent.com/developer/article/1344365?from=15425

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

给Hexo添加Github贡献日历图

发表于 2022-07-08

图示

样式一

Zfour's github stats

样式二

样式三

小冰的插件效果

接下来给大家介绍它们的实现方法

代码实现

第一种

只需将username的值设置为你的github用户名即可:

1
https://github-readme-stats.vercel.app/api?username=github用户名

然后以图片的形式进行加载:

1
![](https://github-readme-stats.vercel.app/api?username=github用户名)

如果是放置在html中, 替换用户名后 拷贝以下代码:

1
<img src="https://github-readme-stats.vercel.app/api?username=github用户名" referrerpolicy="no-referrer" ">

项目GitHub: github-readme-stats

第二种

和第一种类似, 尾部改成github用户名即可

1
https://ghchart.rshah.org/github用户名

然后以图片的形式进行加载:

1
![](https://ghchart.rshah.org/github用户名)

如果是放置在html中, 替换用户名后 拷贝以下代码:

1
<img src="https://ghchart.rshah.org/github用户名"  referrerpolicy="no-referrer" ">

项目GitHub: githubchart-api

第三种

这种是以hexo插件的形式实现, 具体步骤如下:

  1. 安装插件

    1
    npm i hexo-githubcalendar --save
  2. hexo根目录下的config文件添加如下配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    # Ice Kano Plus_in
    # Hexo Github Canlendar
    # Author: Ice Kano
    # Modify: Lete乐特
    githubcalendar:
    enable: true
    enable_page: /
    user: 你的github用户名
    layout:
    type: id
    name: recent-posts
    index: 0
    githubcalendar_html: '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>'
    pc_minheight: 280px
    mobile_minheight: 0px
    color: "['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']"
    api: https://python-github-calendar-api.vercel.app/api
    # api: https://python-gitee-calendar-api.vercel.app/api
    calendar_js: https://cdn.jsdelivr.net/gh/Zfour/hexo-github-calendar@1.21/hexo_githubcalendar.js
    plus_style: ""

    将user属性修改为你的github用户名即可,

    • 其他属性用法可参见《教程:hexo-githubcalendar 插件 1.0》

    • 涉及主题: hexo-theme-butterfly

    • 插件GitHub: hexo-github-calendar

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

解决图片的防盗链导致图片显示不出来

发表于 2022-07-08

前言

你平常有可能将图片存放到github、gitee 或者博客园 简书等等地方, 供静态博客使用, 除了github之外 大部分国内的网站都设置了图片防盗链

如果直接使用会导致图片无法显示

解决防盗链的问题其实也非常简单

解决方案

在html的head标签中添加如下代码即可:

1
<meta name="referrer" content="never">

如果你只想处理某部分图片, 可以针对性设置, 比如:

1
<img src="xxxx.jpg" referrerPolicy="no-referrer" />

批量替换图片域名

偶尔图床CDN挂了需要更换域名, 一些文章存放在数据库,比如wordpress网站 为了方便 可以采用js动态替换的方式, 将以下代码拷贝到html页脚标签中即可

1
2
3
4
5
6
7
8
<script>

let context = Array.prototype.map.call(document.images, (event) => {
event.src = event.src.replace("cdn.jsdelivr.net/gh/xxx/xxx", "raw.staticdn.net/xxx/xxx/master")

});

</script>

另外还可以动态添加meta标签

1
2
3
4
5
6
7
8
9
10
11
const addMeta = (name, content) => {
const meta = document.createElement('meta');
meta.content = content;
meta.name = name;
document.getElementsByTagName('head')[0].appendChild(meta);
};

addMeta(
'referrer',
'never',
);

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

Android锁屏息屏状态下弹出界面

发表于 2022-07-07

前言

最近公司客户端项目需要支持锁屏息屏状态下弹出应用界面, 类似于微信来电显示, 实现方法很简单, 如下:

实现步骤

第一步 在清单文件中添加休眠唤醒和解锁权限
1
2
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
第二步 在需要弹出显示的Activity的onCreate方法中添加相应flag代码
1
2
3
4
5
6
7
8
9
10
11
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED //锁屏显示
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD //解锁
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON //保持屏幕不息屏
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);//点亮屏幕

setContentView(R.layout.activity_main);

}
第三步 触发Activity启动

比如推送触发 后台Service触发 或者IM长连接信令触发等等

1
2
3
4
private void openActivity(Context context, String msg) {
Intent intent = new Intent(context, MainActivity.class)ialarmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
context.startActivity(intent);
}
完毕

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

关于Github加速方法总结

发表于 2022-07-07

前言

最近网站大部分图片访问变慢, 原因出在jsdelivr加速失效, 为此我更换了CDN域名, 顺带总结一下github加速小技巧

GitHub访问加速

1. 使用镜像访问

这相当于是克隆版的 GitHub , 网站的内容和 GitHub 是完整同步, 可以在这个网站里面进行下载克隆等操作, 镜像地址如下:

  • https://hub.fastgit.org

使用示范:

1
2
3
4
5
https://github.com/typecho/typecho

可以改成

https://hub.fastgit.xyz/typecho/typecho
2.修改Host文件加速

首先需要获取对应域名实际ip地址, 可以通过以下网站查询:

  • https://www.itdog.cn/

  • https://www.ipaddress.com/

image-20220707154831063

需要查询的地址有:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 基本地址
'github.com',
'gist.github.com',
'assets-cdn.github.com',
'raw.githubusercontent.com',
'gist.githubusercontent.com',
'cloud.githubusercontent.com',
'camo.githubusercontent.com',
'avatars0.githubusercontent.com',
'avatars1.githubusercontent.com',
'avatars2.githubusercontent.com',
'avatars3.githubusercontent.com',
'avatars4.githubusercontent.com',
'avatars5.githubusercontent.com',
'avatars6.githubusercontent.com',
'avatars7.githubusercontent.com',
'avatars8.githubusercontent.com',
'avatars.githubusercontent.com',
'github.githubassets.com',
'user-images.githubusercontent.com',
'codeload.github.com',
'favicons.githubusercontent.com',
'api.github.com'

一个一个查询太过麻烦, 可以使用python脚本快速批量获取, 代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# coding:utf-8

import socket

def output_hosts():
domains = ['github.com',
'gist.github.com',
'assets-cdn.github.com',
'raw.githubusercontent.com',
'gist.githubusercontent.com',
'cloud.githubusercontent.com',
'camo.githubusercontent.com',
'avatars0.githubusercontent.com',
'avatars1.githubusercontent.com',
'avatars2.githubusercontent.com',
'avatars3.githubusercontent.com',
'avatars4.githubusercontent.com',
'avatars5.githubusercontent.com',
'avatars6.githubusercontent.com',
'avatars7.githubusercontent.com',
'avatars8.githubusercontent.com',
'avatars.githubusercontent.com',
'github.githubassets.com',
'user-images.githubusercontent.com',
'codeload.github.com',
'favicons.githubusercontent.com',
'api.github.com'
]

with open('hosts.txt', 'w') as f:
f.write('```\n')
f.write('# GitHub Start \n')
for domain in domains:
print('Querying ip for domain %s'%domain)
ip = socket.gethostbyname(domain)
print(ip)
f.write('%s %s\n'%(ip, domain))
f.write('# GitHub End \n')
f.write('```\n')



if __name__ == '__main__':
output_hosts()

执行脚本后, 得到如下结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# GitHub Start 
140.82.121.3 github.com
140.82.121.3 gist.github.com
185.199.110.153 assets-cdn.github.com
185.199.108.133 raw.githubusercontent.com
185.199.111.133 gist.githubusercontent.com
185.199.110.133 cloud.githubusercontent.com
185.199.111.133 camo.githubusercontent.com
185.199.111.133 avatars0.githubusercontent.com
185.199.110.133 avatars1.githubusercontent.com
185.199.111.133 avatars2.githubusercontent.com
185.199.109.133 avatars3.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.111.133 avatars5.githubusercontent.com
185.199.109.133 avatars6.githubusercontent.com
185.199.109.133 avatars7.githubusercontent.com
185.199.110.133 avatars8.githubusercontent.com
185.199.108.133 avatars.githubusercontent.com
185.199.111.154 github.githubassets.com
185.199.109.133 user-images.githubusercontent.com
140.82.112.9 codeload.github.com
185.199.110.133 favicons.githubusercontent.com
192.30.255.116 api.github.com
# GitHub End

将以上内容拷贝到系统Host文件中即可, 不同操作系统host文件所在路径不一样:

  1. Windows系统:修改C:\Windows\System32\drivers\etc\hosts文件
1
2
# 网络刷新
ipconfig /flushdns
  1. Linux系统:修改C:\Windows\System32\drivers\etc\hosts文件

    1
    2
    # 网络刷新
    systemctl restart network

仓库Clone下载加速

1. 将仓库克隆到Gitee

image-20220707151023271

2.使用Fast-GitHub浏览器插件

Fast-GitHub

image-20220707151433012

3.第三方网站解析加速

Toolwa

image-20220707151746721

gh-proxy

image-20220707152513916

Ghproxy

image-20220707155957192

image-20220707160024075

Raw资源加速

1. 使用fastgit

将raw.githubusercontent.com替换成raw.staticdn.net或者raw.gitmirror.com

使用示例

实际上fastgit功能很丰富, 几乎囊括了github所有. 具体如下表:

反代列表

站源 地址 缓存
github.com hub.fastgit.xyz 无
raw.githubusercontent.com raw.staticdn.net 无
github.githubassets.com assets.fastgit.org 无
customer-stories-feed.github.com customer-stories-feed.fastgit.org 480 分钟
Github Download download.fastgit.org 480 分钟
GitHub Archive archive.fastgit.org 无

fastgit官网

2.使用ghproxy

在https://raw.githubusercontent.com地址前面添加https://ghproxy.com/

比如:

1
https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

Hexo NexT 主题渲染 Mermaid 绘图

发表于 2022-07-05

前言

由于我的Hexo博客中的Next主题是旧版, 并不支持mermaid, 因此需要手动配置, 步骤如下

配置步骤

第一步 安装 mermaid 插件

在博客的根目录下,执行以下命令安装 hexo-filter-mermaid-diagrams 插件

1
$ npm install hexo-filter-mermaid-diagrams --save
第二步 NexT 启用 Mermaid

打开 NexT 主题的 _config.yml 配置文件,添加以下代码:

1
2
3
4
5
# Mermaid tag
mermaid:
enable: true
# Available themes: default | dark | forest | neutral
theme: default
第三步 添加script脚本

打开next/layout/_partials/footer.swig文件, 添加以下代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{% if theme.mermaid.enable %}
<script type="text/javascript" src='https://unpkg.com/mermaid@9.0.0/dist/mermaid.min.js'></script>
<script>
if (window.mermaid) {
var mermaid_config = {
startOnLoad: true,
theme: '{{theme.mermaid.theme}}',
flowchart:{
useMaxWidth: false,
htmlLabels: true
}
}
mermaid.initialize(mermaid_config);
}
</script>
{% endif %}

至此 配置完毕


js本地引用

如果你打算将js文件存放在本地, 可以将js文件放置到next/source/js/src目录下, 那么script脚本改成如下即可:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{% if theme.mermaid.enable %}
<script type="text/javascript" async src='js/src/mermaid.min.js'></script>
<script>
if (window.mermaid) {
var mermaid_config = {
startOnLoad: true,
theme: '{{theme.mermaid.theme}}',
flowchart:{
useMaxWidth: false,
htmlLabels: true
}
}
mermaid.initialize(mermaid_config);
}
</script>
{% endif %}

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

关于Markdown图表绘制

发表于 2022-07-03

前言

写作时难免会有图表绘制需求 比如下面几种

示例

第一种样式时序图
1
2
3
4

Alice -> Bob:Hello Bob, How are you?
Note right of Bob: Bob thinks
Bob -> Alice: I am good thanks!
第二种样式时序图
 sequenceDiagram
    participant Alice
    participant Bob
    Alice->John: Hello John, how are you?
    loop Healthcheck
            John->John: Fight against hypochondria
    end
    Note right of John: Rational thoughts 
prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good!
甘特图
  gantt
    dateFormat  YYYY-MM-DD
    title Adding GANTT diagram functionality to mermaid
    section A section
    Completed task            :done,    des1, 2014-01-06,2014-01-08
    Active task               :active,  des2, 2014-01-09, 3d
    Future task               :         des3, after des2, 5d
    Future task2               :         des4, after des3,6d
上下流程图
graph TD;
            A-->B;
            A-->C;
            B-->D;
            C-->D;
左右流程图
graph LR;

律动乐器-->律动+氛围乐器-->律动+鼓组贝斯-->律动+鼓组贝斯+氛围乐器;
铺底+氛围-->铺底+氛围+律动-->铺底+氛围+律动+鼓组贝斯-->追加间奏乐器;
自定义style的流程图
graph LR;
    id1(Start)-->id2(Stop)
    style id1 fill:#f9f,stroke:#333,stroke-width:4px
    style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
各种形状的流程图
graph  TD;
    A[/Christmas\]--> B[\This is the text in the box\]-->
     C[\Go shopping/]-->D[/This is the text in the box/]-->E{{This is the text in the box}}-->F{This is the text in the box}-->G>This is the text in the box]-->H((This is the text in the circle))-->J(This is the text in the box)

语法实现

时序图demo代码:

1
2
3
4
5
6
7
8
9
10
11
12
    <pre class="mermaid">    sequenceDiagram
participant Alice
participant Bob
Alice->John: Hello John, how are you?
loop Healthcheck
John->John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail...
John-->Alice: Great!
John->Bob: How about you?
Bob-->John: Jolly good!</pre>
**甘特图demo代码:**
<pre class="mermaid">    gantt
dateFormat  YYYY-MM-DD
title Adding GANTT diagram functionality to mermaid
section A section
Completed task            :done,    des1, 2014-01-06,2014-01-08
Active task               :active,  des2, 2014-01-09, 3d
Future task               :         des3, after des2, 5d
Future task2               :         des4, after des3, 5d
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison          :crit, done, after des1, 2d
Create tests for parser             :crit, active, 3d
Future task in critical line        :crit, 5d
Create tests for renderer           :2d
Add to mermaid                      :1d</pre>

流程图demo代码:

    <pre class="mermaid">    graph TD;
            A-->B;
            A-->C;
            B-->D;
            C-->D;</pre>

### 总结

以上只是列举其中几种 , 除此之外还可以绘制饼状图 状态图 类图 需求图等等

更多技巧可以参考`mermaid`文档: 《[mermaid官方文档](https://mermaid-js.github.io/mermaid/#/flowchart)》





**本文为作者原创转载时请注明出处 谢谢**

![](https://gitee.com/songjianzaina/SavePicGoPic/raw/master/img/20191119095516.png)

*[乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站](https://code.newban.cn/)*

关于Git查看提交修改的文件列表

发表于 2022-06-28

1.查看最后一次提交记录的修改文件信息

1
git show --raw

2.查看指定commit id对应修改文件列表

1
git show --raw commit_id
1
git show --raw 2f80f1c8bb2cb8e91d22ad38480b681c194f6518

3.查看所有提交记录的修改文件信息

1
git log --stat
1
git log --name-only

4.查看所有修改相关的commit ID和comment信息

1
git log --pretty=oneline

5.查询指定author的修改信息

1
git log --author=jack.li

6.查看指定author在指定时间修改信息

1
2
3
4
5
6
7
8
$ git log --pretty="%h - %s" --author='Junio C Hamano' --since="2008-10-01" \
--before="2008-11-01" --no-merges -- t/
5610e3b - Fix testcase failure when extended attributes are in use
acd3b9e - Enhance hold_lock_file_for_{update,append}() API
f563754 - demonstrate breakage of detached checkout with symbolic link HEAD
d1a43f2 - reset --hard/read-tree --reset -u: remove unmerged new paths
51a94af - Fix "checkout --track -b newbranch" on detached HEAD
b0ad11e - pull: allow "git pull origin $something:$current_branch" into an unborn branch

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

从found.000中恢复数据 某个文件夹突然不见了

发表于 2022-06-03

说明

  • 本文是问题解决后编写的,解决顺序已经尽力按照我记得的编写。希望能给遇到此问题的朋友一份参考。
  • 因涉及数据此等重要性的东西,建议还是看完全文再操作。在理解了我的解决思路之后,并且觉得我的方案有用方可尝试。切勿在你解决无望的时候,看到本文以为是发现新大陆,然后盲目操作导致数据丢失得不偿失!(因为我搜索过关于found.000的相关,有些人说用数据恢复软件,有些人说这个文件恢复不了,还有人提问该文件夹能不能删除诸如此类)
  • 但是你还是想尝试,可以尝试复制一份found.000出来,在别的盘上或者电脑上对该文件夹进行操作。(切勿在源路径操作,方便你实在不行的情况下拿去维修)或者你对自己非常有信心,就在源路径下操作吧(因为我也不知道复制出来能不能恢复😂)。
  • 本文更多的是提供思路,实际操作需要的一些诸如命令行操作,文件夹提权等需要大家自行百度。

    问题说明(此时我的电脑上是没有found.000这个文件的)

    某天我的D盘下的“资料”文件夹突然不见了。
    当时我的思路是:
  1. 该文件夹被病毒隐藏了?

  2. 我之前误删了?

初步解决方案

通过问题排查(查看隐藏文件+受保护的文件),发现思路1是错误的。

那接下来就是怎么验证误删?因为该文件夹比较大,删除的情况下会提示放入不了回收站,要直接删除吗?所以回收站没有我的删除记录。然后思路2的解决方法是进PE使用数据恢复软件(如:Recuva,金山数据恢复)查看有没有相关痕迹,结果发现没有“资料“文件夹被删除的相关痕迹(着急解决问题,没想到截图)。(进不进PE没多大关系,但可能是因为我进PE恢复数据导致重启电脑的时候进行磁盘检查,然后我的电脑上才有found.000)

经过以上的方案,还是不行之后。我剩下的思路只有装杀软看看。但是,我没有装,因为接下来的操作我也是第一次遇到。

无意中,我使用 everything 软件进行搜索”资料”的时候,通过搜索结果看到我的文件还是存在的。忘记截图了,但我记得结果是xxx资料 D:\资料\xxx。当时我看到我的文件夹存在的时候很开心,马上右键打开所在路径,结果提示:请检查你的路径,没有该路径之类的话。(当时我一脸懵圈。everything可以搜索到,难道是everything之前的索引还存在?这个结果只是一个假象?)

  • everything的结果说明了什么?(我此时相信我的文件夹还是存在的)说明了我的文件夹还是存在的。没有被数据恢复软件没有检索到是因为我的文件夹根本没有被删除啊。但是不知道为什么就是看不到它了(注意,此时并不是隐藏,因为常规的查看隐藏文件方式已经不起作用了,我的理解是,因为某个原因,系统对”资料“这个文件夹的索引没有了)

    可行的解决方案

  • step1: 确保你的硬盘里有found.000*
    因为我成功解决问题的基础是有这个文件。所以只需要在重启的时候进行磁盘检查,让系统重新找回对这个文件夹的索引。(如果你的电脑此时有这个文件跳过这一步)

step2: 存在 found.000后
使用everything 搜索一下丢失文件夹的关键字。如下:可以看到我的资料都在这个文件夹下。

在这里插入图片描述

step3: 进入文件夹

于是我马上右键打开所在路径,我的天!进来了。我试了一下打开 pdf ,是可以打开的。我马上复制一份到别的盘打开,是可以打开的!于是我慢慢一步一步点上一级路径跳转,是可以访问的。可是当我点击dir0001.chk之后提示错误了。(具体提示的错误我忘记了)

在这里插入图片描述

step4: 从文件浏览器进入found.000

因为step3: 倒着进不了上一级路径。此时我想能不能正着进入该路径,于是我从文件夹点进去,提示权限不足,此时对文件夹提权就好了。

在这里插入图片描述

进入后,发现如下:(写下此文的时候我已经忘记相关弹窗提示,但是我记得我第一次提权进入该文件夹的时候没有这么多东西的,我是进行了step5才看到下图如此完整的文件夹)

在这里插入图片描述

step5: 从bash进入dir0001.chk

在step4我说明了我第一次进入found.000文件夹是没有什么东西的。于是我的思路是:无论如何都要进入单片机的上一级目录(我原本保存的路径就是D:\资料\单片机),所以虽然不能进入found.000,但是只要我进入”单片机“上一级目录就可以对我之前的数据全部复制保存。

  • 怎么操作?很简单,当时我想到的是从命令行看能不能进入,于是有下图:

    在这里插入图片描述

奇怪的是,我从命令行进入单片机的上一级目录之后,我就可以正着进found.000文件夹,并且还能看到比较多的文件夹了。才有了step4的第二张截图。然后也有了下面的截图。

在这里插入图片描述

经过我的发现,之前的数据并不是全都在dir0001.chk中,在found000文件下的其他dirxxxx.chk都保存了我之前的资料。大家不放心每个文件夹都点开看看吧!

总结

  1. 想办法让电脑中存在 found.000(通过重启后进行磁盘检查)
  2. 想办法进入found.000(通过命令行,必要时结合 everything)
  3. 事后我想,是不是一开始就可以通过 命令行 进入该文件夹了?即使不能正着进去,我也可以通过 everything 打开所在路径之后再通过命令行进入,然后通过cp命令直接复制到别的盘保存。
  4. 同时,我成功恢复数据感觉也是很多的机缘巧合,比如,如果我不进PE恢复数据,是不是就没有磁盘检查了,也就没有生成found.000,我可能就还不能解决此问题了!

本文转载自: https://blog.csdn.net/u011897411/article/details/106879852

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

记录关于移动硬盘文件丢失的找回过程

发表于 2022-06-01

起因

由于居家办公需要, 经常使用移动硬盘来回在公司和宿舍之间进行大文件拷贝, 某一天突然发现硬盘中的文件夹消失不见, 而空间占用依然存在

难道是文件被隐藏了? 检查一番之后发现不是

当时我就慌了 因为消失的都是重要文件, 于是赶紧百度

搜索一阵之后, 我推测可能是不同系统兼容性错误导致的磁盘坏道

因为公司的电脑是Mac系统 宿舍的电脑是Windows系统, 而我的硬盘格式是NTFS, Mac本身是不兼容该格式的, 加上我使用了Omi NTFS这个工具进行桥接中转 硬盘出现点问题 似乎是情理之中

既然发现了问题所在, 那就需要解决 尽可能地将文件恢复回来

而我第一时间想到的便是进行磁盘修复, 当我在Windows平台中对硬盘进行修复之后, 丢失的文件夹确实出现了 但是却变成了一个未知文件 无法打开

这就有点坑了

无奈之下我停止了对该硬盘进行文件写入操作, 免得操作频繁导致后期无法恢复

于是将该硬盘放置了一段时间, 直到有一天我需要从硬盘中未被破坏的文件夹里面找寻一些资料, 顺带使用了everything软件检索, 突然获得了意外惊喜, everything检索到了丢失文件夹中的资料

这意味着文件依然存在于移动硬盘中, 可能是被迁移到了某个隐藏文件中

我利用everything找到了丢失文件所在目录, 名为found.000

这个found.000目录是隐藏目录, 即便开启显示隐藏文件夹功能也是看不到的, 而且这个目录需要管理员权限才能对里面的文件进行拷贝移动操作

既然目录找到了 那么恢复文件就不难了

操作步骤

  1. 打开管理员cmd窗口, 进入到found.000目录

    1
    F:    //进入移动硬盘盘符
    1
    cd found.000   //打开隐藏文件
  2. 列出当前目录下所有文件夹和文件(包含隐藏文件夹)

    1
    dir /A *
  3. 移动文件

    1
    move 需要移动的文件或文件夹名 目标文件夹名

被恢复的目录中可能会存在一些隐藏目录, 为了确保所有文件都恢复, 需要仔细检查

网上有位小伙伴也碰到了和我类似的问题, 大家有兴趣的可以参考一番:

《【问题记录】从found.000中恢复数据(某个文件夹突然不见了)》

本文为作者原创转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

1…161718…51

乱码三千

android程序员一枚,擅长java,kotlin,python,金融投资,欢迎交流~

505 日志
145 标签
RSS
© 2026 乱码三千
本站总访问量次
由 Hexo 强力驱动
|
主题 — NexT.Muse v5.1.4
0%