当前位置:网站首页>Why is the lightweight VsCode used more and more?Why eat my C drive 10G?How to Painlessly Clean VsCode Cache?Teach you how to lose weight for C drive
Why is the lightweight VsCode used more and more?Why eat my C drive 10G?How to Painlessly Clean VsCode Cache?Teach you how to lose weight for C drive
2022-08-01 05:32:00 【Tisfy】
VsCode是一款轻量级代码编辑器
Available for a while will be quickly found,“轻量级”的VsCode并不轻量
不统计不知道,一统计吓一跳,使用了一段时间后,VsCode占用了我C盘10G+的空间!
好家伙,So I decided to take care of itVsCode,让VsCodebecome really lightweight.
VsCodespace occupancy analysis
VsCode所占用的空间,主要包括四大部分(Below are the results I counted when I wrote this blog):
程序的安装目录
:大约会占用350M%userprofile%\.vscode
:可达800M.主要为:each expansion.VsCodeUninstalling the extension doesn't seem to delete the files on the hard drive,So this one is huge,And there are a lot of unnecessary ones mixed in%userprofile%\AppData\Local\Microsoft\vscode-cpptools\ipch
:can be reached in a period of time4G 与C(++)语言有关,It can be deleted directly after closing the program.不使用VsCode编辑C/C++users may not experience this pain%userprofile%\AppData\Roaming\Code
:2G+ 存放用户数据、配置等. (Can be added at startup–user-data-dir NewDir to make other directories as configuration)
Where it can be deleted periodically,有3. ipch
(Can be completely removed) 和 4. Romaing
(It cannot be completely deleted)
4. Romaing中,Exactly which ones can be deleted periodically
对%userprofile%\AppData\Roaming\Code
files in for further analysis,I came to the following conclusion:
%userprofile%\AppData\Roaming\Code\CachedExtensionVSIXs can be reached in a period of time500M 可以直接删
%userprofile%\AppData\Roaming\Code\Cache soon dozensM
%userprofile%\AppData\Roaming\Code\CachedData soon dozensM
%userprofile%\AppData\Roaming\Code\CachedExtensions When installing a new plugin,It doesn't seem to be automatically deleted by default,Install the plug-in as many as you can800M
%userprofile%\AppData\Roaming\Code\CachedExtensionVSIXs Anyway, it is also related to the plugin,can reach several hundredM
%userprofile%\AppData\Roaming\Code\Code Cache 十几M
%userprofile%\AppData\Roaming\Code\Crashpad 十几M Used to store crash information
%userprofile%\AppData\Roaming\Code\logs 几十M This can be deleted directly,Used to store log records
%userprofile%\AppData\Roaming\Code\Service Worker 1G
%userprofile%\AppData\Roaming\Code\Service Worker\CacheStorage 1G Mainly located here
%userprofile%\AppData\Roaming\Code\Service Worker\ScriptCache 10M
%userprofile%\AppData\Roaming\Code\User 600M
%userprofile%\AppData\Roaming\Code\User\workspaceStorage 500M Each time a working directory is opened, a folder is generated in this directory
%userprofile%\AppData\Roaming\Code\User\History 100M
每Ctrl+S(Only successful re-save with modifications)One copy is made at a time.
这个不是按gitThe idea is to store only changes,but the entire file in its entiretyCopy一份.
一个100多kThe source code is saved ten times1M,Handy for habitCtrl+Susers will take up a lot of space
但是,Deletion will affect the restoration of historical versions.
其中,The filename uses code obfuscation technology,Each file generates a folder,真正的文件名、The corresponding file storage time of each file is under each folderentries.json中
%userprofile%\AppData\Roaming\Code\User\snippets 这个不能删,And remember to back up when reinstalling(If not automatically restored)This is a user-defined code snippet
A directory that can be deleted periodically
%userprofile%\AppData\Local\Microsoft\vscode-cpptools
%userprofile%\AppData\Roaming\Code\CachedExtensionVSIXs
%userprofile%\AppData\Roaming\Code\Cache
%userprofile%\AppData\Roaming\Code\CachedData
%userprofile%\AppData\Roaming\Code\CachedExtensions
%userprofile%\AppData\Roaming\Code\CachedExtensionVSIXs
%userprofile%\AppData\Roaming\Code\Code Cache
%userprofile%\AppData\Roaming\Code\Crashpad
%userprofile%\AppData\Roaming\Code\logs
%userprofile%\AppData\Roaming\Code\Service Worker\CacheStorage
%userprofile%\AppData\Roaming\Code\Service Worker\ScriptCache
%userprofile%\AppData\Roaming\Code\User\workspaceStorage
%userprofile%\AppData\Roaming\Code\User\History
It is impossible to delete so many folders one by one manually,So I wrote a script:
@REM example:
@REM del "%userprofile%/AppData/Local/Microsoft/vscode-cpptools/ipch/" /s /q /f
@REM rd "%userprofile%/AppData/Local/Microsoft/vscode-cpptools/ipch/" /s /q
@REM md "%userprofile%/AppData/Local/Microsoft/vscode-cpptools/ipch/"
@echo off
call:EmptyOneDir "%userprofile%\AppData\Local\Microsoft\vscode-cpptools"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\CachedExtensionVSIXs"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\Cache"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\CachedData"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\CachedExtensions"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\CachedExtensionVSIXs"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\Code Cache"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\Crashpad"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\logs"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\Service Worker\CacheStorage"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\Service Worker\ScriptCache"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\User\workspaceStorage"
call:EmptyOneDir "%userprofile%\AppData\Roaming\Code\User\History"
goto end
:EmptyOneDir rem same as Let empty [path] /q
echo empty %1
echo del %1 /s /q /f
del %1 /s /q /f
echo rd %1 /s /q
rd %1 /s /q
echo md %1
md %1
:end
Just save this script as CleanVsCode.bat,and double-click to run it once at regular intervals,This frees up a lot of space on a regular basis
当然,The space freed is directly up to youVsCodeThe resulting cache size,Indirectly depends on youVsCode的使用次数.
最好关闭VsCodeThen run the script.
️Warning
Run it again after running the scriptVsCodeBasically don't see any difference,Only the files opened in the current working path need to be manually clicked to open again.
It's a script that deletes a lot of things after all,因此请谨慎使用.
I am the original blogger of this blog,Just to provide you with a convenient method,But its possible consequences,Bloggers are not responsible.
But you can rest assured,I'm running this script regularly myself.
Add it when you're readyWindows计划,to automatically release space on a regular basis.
原创不易,转载请附上原文链接哦~
Tisfy:https://letmefly.blog.csdn.net/article/details/126082324
边栏推荐
猜你喜欢
随机推荐
SL-12/2过流继电器
2022年牛客多校第四场补题
备战金九银十,如何顺利通过互联网大厂Android的笔面试?
导致锁表的原因及解决方法
Selenium: element judgment
Qt Widget 项目对qml的加载实例
Speed up your programs with bitwise operations
ORACLE 实现另外一个用户修改包(package)
Use controls as brushes to get bitmap code records
Jupyter shortcuts
将CSV文件快速导入MySQL中
【FiddlerScript】利用FiddlerScript抓包保利威下载
NUMPY
Challenge 52 days to memorize Peppa Pig (Day 01)
Dialogue with the father of MySQL: One excellent programmer is worth 5 ordinary programmers
字符中的第一个唯一字符
用位运算为你的程序加速
华为Android开发面试后得出的面试秘诀
matlab simulink 粒子群优化模糊pid控制的电机泵
I met a shell script