File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ Add-Type - AssemblyName System.Windows.Forms
2
+
3
+ $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
4
+ $OpenFileDialog.Filter = " Todos los archivos (*.*)|*.*"
5
+ $OpenFileDialog.Multiselect = $false
6
+
7
+ if ($OpenFileDialog.ShowDialog () -eq ' OK' ) {
8
+ $SelectedFilePath = $OpenFileDialog.FileName
9
+ Write-Host " File selected: $SelectedFilePath " - ForegroundColor Green
10
+ Write-Host " "
11
+ } else {
12
+ Write-Host " No se seleccionó ningún archivo." - ForegroundColor Yellow
13
+ Write-Host " "
14
+ }
15
+
16
+
17
+ function Secure-DeleteFile {
18
+ param (
19
+ [string ]$FilePath
20
+ )
21
+
22
+ if (Test-Path $FilePath ) {
23
+ $size = (Get-Item $FilePath ).length
24
+ Write-Host " The file size is: $size " - ForegroundColor Yellow
25
+ Write-Host " "
26
+ $randomBytes = New-Object byte[] $size
27
+ (New-Object Random).NextBytes($randomBytes )
28
+ [System.IO.File ]::WriteAllBytes($FilePath , $randomBytes )
29
+ Write-Host " Processing file to Untraceable File..." - ForegroundColor Yellow
30
+ Write-Host " "
31
+ Remove-Item - Path $FilePath - Force
32
+ Write-Host " File completely deleted from memory!" - ForegroundColor Green
33
+ Write-Host " "
34
+ } else {
35
+ Write-Host " File does not exist: $FilePath " - ForegroundColor Red
36
+ Write-Host " "
37
+ }
38
+ }
39
+
40
+ # Call function with the file selected
41
+ Secure- DeleteFile - FilePath $SelectedFilePath
You can’t perform that action at this time.
0 commit comments