You are not logged in.
Pages: 1
Hello,
Please is there a way to delete all files which have file size lower than 10MB?
I have a tons of different folders with sub-folders and I would like to use ReNamer to delete all unnecessary small files.
For removing of specific files I'm using something like this.
var
ext:string;
begin
ext := WideExtractFileExt(FileName);
if (ext = '.jpg') then
begin
WideDeleteFile(FilePath); //delete the file
end;
end.
It will delete all .jpg files.
However I can't use it all the time as they are files with the same extension and with greater files size which have more importance as only an picture with some icon or logo.
I need to get rid of all the small files.
Thank you for your help.
Offline
You need the WideFileSize function and minor modification of your script:
const
FileSizeLimit = 10 * 1024 * 1024; // 10 Mb
var
Ext: String;
begin
Ext := WideExtractFileExt(FileName);
if (Ext = '.jpg') then
if WideFileSize(FilePath) < FileSizeLimit then
WideDeleteFile(FilePath);
end.
Function reference: ReNamer:Pascal_Script:Functions
Note, ReNamer is not intended for cleaning your file system. You might want to find a tool designed for such tasks.
Offline
It works flawlessly, thank you so much!
I know that for file system there are other tools, but why when ReNamer can do everything and all in one package. And I love to play with the rules
Offline
Pages: 1