-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLargeFileFinder.bat
More file actions
200 lines (188 loc) · 6.39 KB
/
Copy pathLargeFileFinder.bat
File metadata and controls
200 lines (188 loc) · 6.39 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
@echo off
:: ============================================================
:: Name : LargeFileFinder.bat
:: Version : 1.0.0
:: Author : Anamicca23
:: Tested : Windows 10 22H2, Windows 11 23H2
:: Min OS : Windows 10 1803
:: Risk : LOW (read only — no files deleted)
:: Admin : Not Required
:: Reversible: Yes
:: Desc : Scans drives for files over a size threshold.
:: Ranked list with full path, size, and modified date.
:: Saves optional report to Desktop.
:: ============================================================
setlocal enabledelayedexpansion
title LARGE FILE FINDER v1.0.0
mode con: cols=80 lines=45
if not "%1"=="RUN" start /MAX cmd /k "%~f0" RUN & exit
:MENU
cls
color 06
echo.
echo +================================================================+
echo ^| L A R G E F I L E F I N D E R v1.0.0 ^|
echo ^| Find space hogs across your drives ^|
echo +================================================================+
echo ^| ^|
echo ^| [1] Scan C:\ for files over 100 MB ^|
echo ^| [2] Scan C:\ for files over 500 MB ^|
echo ^| [3] Scan C:\ for files over 1 GB ^|
echo ^| [4] Scan ALL drives for files over 100 MB ^|
echo ^| [5] Custom drive and size scan ^|
echo ^| [6] Save last results to Desktop ^|
echo ^| [0] Exit ^|
echo ^| ^|
echo +================================================================+
echo.
set /p c= Enter Option:
if "%c%"=="1" ( set "scanDrive=C:\" & set "threshold=104857600" & set "threshMB=100" & goto SCAN )
if "%c%"=="2" ( set "scanDrive=C:\" & set "threshold=524288000" & set "threshMB=500" & goto SCAN )
if "%c%"=="3" ( set "scanDrive=C:\" & set "threshold=1073741824" & set "threshMB=1024" & goto SCAN )
if "%c%"=="4" goto SCANALLDRIVES
if "%c%"=="5" goto CUSTOM
if "%c%"=="6" goto SAVEREPORT
if "%c%"=="0" goto EXIT
goto MENU
:CUSTOM
cls
color 06
echo.
echo Enter the drive path to scan (e.g. C:\ D:\ E:\Users):
set /p scanDrive= Drive/Path:
echo.
echo Enter minimum file size in MB (e.g. 50 100 500 1024):
set /p threshMB= Min MB:
set /a threshold=threshMB*1048576
echo.
echo Scanning !scanDrive! for files over !threshMB! MB...
goto SCAN
:SCAN
cls
color 06
echo.
echo +================================================================+
echo ^| Scanning: !scanDrive! Threshold: !threshMB! MB
echo ^| This may take a few minutes on large drives... ^|
echo +================================================================+
echo.
set "reportFile=%TEMP%\LargeFiles_temp.txt"
if exist "%reportFile%" del "%reportFile%"
set "count=0"
for /r "!scanDrive!" %%f in (*) do (
if exist "%%f" (
set "fsize=%%~zf"
if defined fsize (
if !fsize! gtr !threshold! (
set /a count+=1
set /a fmb=fsize/1048576
echo !fmb! MB %%~tf %%f
echo !fmb! MB %%~tf %%f >> "!reportFile!" 2>nul
)
)
)
)
echo.
echo +----------------------------------------------------------------+
if !count!==0 (
color 0A
echo No files larger than !threshMB! MB found in !scanDrive!
) else (
color 0E
echo Found !count! file(s) over !threshMB! MB.
echo Results saved temporarily. Use option [6] to export to Desktop.
)
echo +----------------------------------------------------------------+
echo.
pause
goto MENU
:SCANALLDRIVES
cls
color 06
echo.
echo Scanning all available drives for files over 100 MB...
echo This may take several minutes...
echo.
set "threshold=104857600"
set "threshMB=100"
set "totalCount=0"
set "reportFile=%TEMP%\LargeFiles_temp.txt"
if exist "%reportFile%" del "%reportFile%"
for /f "tokens=1" %%d in ('wmic logicaldisk get Caption /value 2^>nul ^| findstr "=" ^| findstr /v "^$"') do (
set "dline=%%d"
for /f "tokens=2 delims==" %%x in ("!dline!") do (
set "drv=%%x"
set "drv=!drv: =!"
if defined drv if not "!drv!"=="" (
echo Scanning !drv!\...
for /r "!drv!\" %%f in (*) do (
if exist "%%f" (
set "fsize=%%~zf"
if defined fsize (
if !fsize! gtr !threshold! (
set /a totalCount+=1
set /a fmb=fsize/1048576
echo !fmb! MB [!drv!] %%~tf %%f
echo !fmb! MB [!drv!] %%~tf %%f >> "!reportFile!" 2>nul
)
)
)
)
)
)
)
echo.
echo +----------------------------------------------------------------+
if !totalCount!==0 (
color 0A
echo No files larger than 100 MB found.
) else (
color 0E
echo Found !totalCount! file(s) over 100 MB across all drives.
echo Use option [6] to export full report to Desktop.
)
echo +----------------------------------------------------------------+
echo.
pause
goto MENU
:SAVEREPORT
cls
color 0B
echo.
if not exist "%TEMP%\LargeFiles_temp.txt" (
echo No scan results to save yet.
echo Run a scan first (options 1-4), then save.
echo.
pause
goto MENU
)
set "rpt=%USERPROFILE%\Desktop\LargeFiles_Report.txt"
(
echo ================================================================
echo LARGE FILE FINDER REPORT
echo Generated : %DATE% %TIME%
echo Computer : %COMPUTERNAME%
echo Threshold : !threshMB! MB
echo ================================================================
echo.
echo Size(MB) Modified Date Full Path
echo -------- ------------- ---------
type "%TEMP%\LargeFiles_temp.txt"
echo.
echo ================================================================
echo END OF REPORT
echo ================================================================
) > "%rpt%" 2>nul
if exist "%rpt%" (
echo [OK] Report saved to Desktop as LargeFiles_Report.txt
echo.
echo Open with Notepad to review all large files found.
) else (
echo [ERROR] Could not save report to Desktop.
)
echo.
pause
goto MENU
:EXIT
if exist "%TEMP%\LargeFiles_temp.txt" del "%TEMP%\LargeFiles_temp.txt" >nul 2>&1
exit