Windows - selectively delete large files instead of moving them to the Recycle Bin
Is it possible to set Windows to permanently delete only large files (arbitrary limit set by me) instead of moving them to the Recycle bin ?
More exactly: when I click delete on a file, lets say of 3.3GB, should be deleted, but when I do the same for a file of 240MB should move in the Recycle Bin. I want to set a threshold myself depending on my needs.
Is this possible ? Is there a hidden setting in Registry to enable/force this ?
do you know?
how many words do you know
See also questions close to this topic
-
WebView2 JS injection returns empty json string
With WebView2 for targeting Windows, I am trying to setup my own context menu. Either by selected text or by underlying element pointed by mouse click.
However, I can't get DOM element by mouse operation or even by byId. I think my JavaScript injection or WebView property setting is something wrong, but not too sure. Can anyone suggest me the resolution?
The version info.
- OS : Windows 10 Pro 21H2 19044.1682
- Visual Studio : Community 2022 17.1.6
- WebView2 : 1.0.1185.39
- Project Property: Target framework=.NET 6.0; Target OS version=10.0.19041.0
Here's the testing code
using Microsoft.Web.WebView2.Core; namespace WinFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); HTML(@"C:\temp\test.html"); } public void HTML(string url) { webView21.CoreWebView2InitializationCompleted += WebView2Control_CoreWebView2InitializationCompleted; webView21.Source = new Uri(url); } private void WebView2Control_CoreWebView2InitializationCompleted(object? sender, CoreWebView2InitializationCompletedEventArgs e) { if (!e.IsSuccess) { MessageBox.Show($"WebView2 creation failed, with exception : {e.InitializationException}"); return; } // subscribe to events we are interested in webView21.CoreWebView2.ContextMenuRequested += CoreWebView2_ContextMenuRequested; // user clicked right mouse to show context menu } private async void CoreWebView2_ContextMenuRequested(object? sender, Microsoft.Web.WebView2.Core.CoreWebView2ContextMenuRequestedEventArgs e) { IList<CoreWebView2ContextMenuItem> menuItemList = e.MenuItems; menuItemList.Clear(); // clear default menu items, like prev, next, property //GETTING SELECTED TEXT string text = e.ContextMenuTarget.HasSelection ? e.ContextMenuTarget.SelectionText : ""; // it works if (string.IsNullOrEmpty(text)) // no text selection, then examine DOM { //GET AN UNDERLYING ELEMENT FROM MOUSE POINT var result = await webView21.CoreWebView2.ExecuteScriptAsync($"document.elementFromPoint({e.Location.X},{e.Location.Y})"); //it doesn't work, just returns an empty JSON text (not null) //var result = await webView21.CoreWebView2.ExecuteScriptAsync("function foo(){return 'foo() gets called';}; foo();"); //for testing purpose, it works //var result = await webView21.CoreWebView2.ExecuteScriptAsync("function foo(){return document.getElementById('table-content'};foo();)"); //it returns an empty result } // TO DO // setup menuItem tree based on the result we got //...... //...... e.Handled = true; } } }
-
site only opens in CefSharp
zaakr.net is a site can be opened only in zaakr.exe application or through android(.apk), when opened in browser u been redirected to https://browser.zaakr.net so u download there application, (.exe) file is using cefsharp as a browser so it can access website, from 2 month i could open it from chromium as cefsharp uses chromium, now i can't access website through chromium for some reason idk, i even made a cefsharp browser myself using visual studio nothing worked all the time i been redirected to browser.zaakr.com, i want to access through any browser that have devtools available for a project, note that application zaakr.exe is still using cefsharp even the older version still can access site. i would appreciate any help, sry for any spelling mistakes, thanks.
-
Subprocess $Env:Path python: The filename, directory name, or volume label syntax is incorrect
I am trying to change the windows environment variables, but I am having trouble doing so.
Before I tried to use
os.environ()
I tried out using powershell commands and adding a string to$Env:Path
which worked, but removing it with:$env:Path = ($env:Path.Split(';') | Where-Object -FilterScript {$_ -ne $Remove}) -join ';'
however didn't seem to remove it being my path I want to add
("FFmpeg:C:\Users\user\AppData\"
) and adding it with+= C:/Users/etc..
didn't see, the way to go.Another way I tried to add vars through the Powershell commands was using
SetEnviormentVariable
and it seemed to work fine but once I restarted my PC the entry I made with it was gone.Sadly though all in the end all my powershell commands didn't work with subprocess. Whatever command it was I was using here I got:
PS C:\Users\Me123> python >>> import subprocess >>> subprocess.run("$Env:Path", shell=True) The filename, directory name, or volume label syntax is incorrect. CompletedProcess(args='$Env:Path', returncode=1)
-
How to disable saved/modified markers in Visual Studio?
VS2022 displays for example green vertical lines (next to line numbers) as indicators of saved changes. How to disable/hide those markers?
-
Is there a way to extract login so that it can be used in settings.gradle?
I'm using composite builds, and most of the
settings.gradle
of every project look pretty similar. Is there a way to extract logic?I've created plugins and extracted logic for the
build.gradle
, butsettings.gradle
is special. Any solution -
Cannot Delete .txt File
I want to to make program that delete the Trainer.txt and replace it with Temp.txt and rename it to Trainer.txt. So the whole code is about deleting specific line based on the TrainerIDText. The temp file is successfully created without the deleted information inside.
Image of Trainer.txt and Temp.txt
Scanner x; String removeTerm=TrainerIDText.getText(); String filepath = "C:\\Users\\enric\\OneDrive\\Desktop\\Assignment.txt\\Trainer.txt"; String tempFile = "C:\\Users\\enric\\OneDrive\\Desktop\\Assignment.txt\\Temp.txt"; File oldFile = new File(filepath); File newFile = new File(tempFile); String ID = "" ; String name = "" ; String ic = "" ; String dob = "" ; String address = "" ;String contact = "" ; String specialization = "" ; try { FileWriter fw = new FileWriter(tempFile,true); BufferedWriter bw = new BufferedWriter(fw); PrintWriter pw = new PrintWriter(bw); x = new Scanner(new File(filepath)); x.useDelimiter("[,\n]"); while(x.hasNext()) { ID =x.next(); name = x.next(); ic = x.next(); dob =x.next(); address = x.next(); contact = x.next(); specialization = x.next(); if(!ID.equals(removeTerm)) { pw.println(ID+","+name+","+ic+","+dob+","+address+","+contact+","+specialization); } } x.close(); pw.flush(); pw.close(); oldFile.delete(); File dump = new File(filepath); newFile.renameTo(dump); JOptionPane.showMessageDialog(null,"Information Deleted"); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Error"+removeTerm); }
The problem is that the Trainer.txt file is not deleting and the Temp.txt file is not changing name to Trainer.txt. Anyone know the issue or solution?
-
VCL.FORMS file needed for Delphi 11 Alexandria as deleted mistakenly from the location
I have mistakenly deleted the delphi source file VCL.FORMS file (C:\Program Files (x86)\Embarcadero\Studio\22.0\source\vcl) for latest Delphi Version 11 Alexandria. It would be helpful if someone can share this library file with me.
-
Function for truncate query in mysql
What is functionality of drop or delete command as i am confuse how the delete function work and its backend code works in mysql
Drop table tablename
-
Samba Recycle foldername format
Samba doc states that you can use variables (section Variable Substituion) to concat strings. We use this feature to generate a (not so) userfriendly recycle folder. Each department gets a share using their department number. See
/etc/samba/smb.conf
:# Department 101 [101] path = /srv/samba/data/departments/101/ read only = no hide unreadable = yes valid users = @"MYDOMAIN\NetworkDrive_FILESERVER_101" # Enable the recycle bin vfs object = acl_xattr recycle recycle:repository = /srv/samba/data/departments/101/#recycle/%U-%t recycle:touch = Yes recycle:keeptree = Yes recycle:versions = Yes
Using
/srv/samba/data/departments/101/#recycle/%U-%t
generates folders within\\fileserver.domain\101\#recycle\
with subfolders for each username and timestamp. Unfortunatley samba only offers a timestamp including seconds (%t
or%T
). This results in a big folder mess. With 6 users and a retention period of 14 days we already got 1602 folders like that.fileserver:/srv/samba/data/departments/101/#recycle# ls -l drwx------+ 3 MYDOMAIN\user2 MYDOMAIN\domain users 22 Sep 30 08:46 user2-20210930_084630 drwx------+ 3 MYDOMAIN\user2 MYDOMAIN\domain users 22 Sep 30 10:06 user2-20210930_100617 drwx------+ 3 MYDOMAIN\user2 MYDOMAIN\domain users 22 Oct 1 09:02 user2-20211001_090246 drwx------+ 3 MYDOMAIN\user2 MYDOMAIN\domain users 26 Oct 1 09:04 user2-20211001_090450
A format string for only the day or the hour would already mitigate this problem. Any idea how to solve this?
-
Windows Server 2019 Cannot empty recycle bin
I have a Windows Server 2019 with 16GB Ram and 400GB HD space. One of the apps saves images uploaded by users which used up all of our HD space. Among other things I found 2 directories with 1 million and 1.2 million text files so I deleted these as the first action to free up some space. All of these went into the recycle bin (at the time I didn't know I could do a shift+del to delete them directly bypassing the recycle bin. Now we we have about 30GB free space on the hard-drive, but cannot empty the recycle bin.
If I open recycle bin, it just hangs while calculating the number of files and space. As it does this its slowly eating up memory until it uses all memory and the server crashes. If I right click on the recycle bin and select empty, nothing appears to happen, but if I look at task manager I can see that Windows Explorer is slowly eating up memory until the system crashes again. So even though I don't open the GUI, the recycle bin is still calculating things which eats up memory until it crashes.
I tried doing this with PowerShell running the command Clear-RecycleBin using the force parameter, it appears to hang in the command window and I can see in task manager that its processing and once again, eating up memory until the system crashes.
I'm really stuck here. How can I empty the recycle bin with out making it to first count the files and estimate the size of data it will remove?
Thanks.