#1 2017-07-31 11:08

drslim
Member
Registered: 2017-07-31
Posts: 2

Deleting .TIFF files if .PNG is present

I have both .PNG & .TIFF image files in a number of folders and only want to delete the .TIFF files.
Please advise how to do this.

Thanks

Offline

#2 2017-07-31 11:22

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Deleting .TIFF files if .PNG is present

Hi drslim

drslim wrote:

I have both .PNG & .TIFF image files in a number of folders and only want to delete the .TIFF files.
Please advise how to do this.

Thanks

I on my own would like to suggests you to use a file manager for such tasks,
as that is not directly related to the scope of a Renamer and there are better places to discuses that .


For example (Exchange '*.txt' by '*.TIFF' at that command):
https://stackoverflow.com/questions/190 … subfolders


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2017-07-31 11:31

drslim
Member
Registered: 2017-07-31
Posts: 2

Re: Deleting .TIFF files if .PNG is present

Thanks. I looked for some software for this task but didnt find anything suitable to date.

Offline

#4 2017-07-31 11:43

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Deleting .TIFF files if .PNG is present

As Stefan has already suggested, ReNamer is designed for renaming files, not deleting them.

An alternative approach is to use Pascal Script rule to rename or move such TIFF files to a different location, which can then be easily deleted via any file manager.

The script below will inspect files with .TIFF or .TIF extensions. If a file has a copy with .PNG extension, then the file will be prefixed with "__DELETE__" text, just to demonstrate this alternative approach.

var
  FileExt: WideString;
  FileAlternative: WideString;
begin
  FileExt := WideUpperCase(WideExtractFileExt(FilePath));
  if (FileExt = '.TIFF') or (FileExt = '.TIF') then
  begin
    FileAlternative := WideChangeFileExt(FilePath, '.PNG');
    if WideFileExists(FileAlternative) then
      FileName := '__DELETE__' + FileName;
  end;
end.

Offline

Board footer

Powered by FluxBB