#1 2008-05-02 20:51

Inf
Member
Registered: 2008-05-02
Posts: 2

Add not yet existing files (dummy file)?

Is there a way to create a sort of dummy file in ReNamer?

Eg. I'm renaming a batch of image files, like

scene_01.jpg
scene_02.jpg
scene_03.jpg <-- not available yet.
scene_04.jpg
scene_05.jpg
...

But say I do not currently have the 03.jpg file, but will get it later on. What I want to know is that, is there a way to put in a "dummy" file in the place of 03.jpg in the rename list, so that the rules apply normally, but the 03 file is just virtual?

For now, if I want to do this, I create a text file, and insert it in the correct position, then proceed with the renaming. Afterwards, I just delete the text file.

For some files, it's easy, but if I need to create dozens of text files to be used as dummies, it becomes a tedious. This is why I'm asking this question. Sorry if it was asked in any other form before.

Thank you for your reply, and thank you for the already great Shutter and ReNamer programs. smile

Offline

#2 2008-05-03 00:17

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

Re: Add not yet existing files (dummy file)?

You can do this through the use of Export/Import features.

Create an empty "files.csv" file, and put into it paths to your imaginary files, e.g.:

c:\temp\file1.txt,
c:\temp\file2.txt,
c:\temp\file3.txt,

NOTE: Each path has to be on the new line and has to be followed by a comma.

Then simply use "Import file paths and new names" option to load this file.

Offline

#3 2008-05-03 03:29

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Add not yet existing files (dummy file)?

Another solution is to use PascalScript for serialization.
Script below will append serialized numbers to the end of filename, but it will skip all the numbers that you put into the array Skip (as it is now it will skip 2, 4 and 5).
You can also control leading zeroes with constant PADTO.

const PADTO = 2;
var
  Index, sIndex: Integer;
  i, first, second: Integer;
  Value: String;
  Initialized, Swap, Error: Boolean;
  Skip : Array of Integer;
  NextSkip : Integer;
begin

//INITIALIZATION (only once for whole renaming operation)   
  if not Initialized then
  begin
//
// PUT NUMBERS TO BE SKIPPED INTO ARRAY Skip:
    Skip := [2,5,4]; 

    
//sorting of array Skip
    repeat  
      Swap:=False; 
      for i:=1 to Length(Skip)-1 do
      begin
        first:=Skip[i-1];
        second:=Skip[i];
        if first > second then
        begin
          Skip[i-1]:=second;
          Skip[i]:=first;
          Swap:=True;
        end;
      end;
     until Swap = False;  

     Error:=False;     
     for i:=1 to Length(Skip)-1 do
     begin
       if Skip[i-1] = Skip[i] then 
       begin
         ShowMessage('ERROR: Duplicates in array Skip!!!'+'     Multiple occurences of: '+IntToStr(Skip[i]));
         Error:=True;
       end;
     end;
     
//Initialization of nessecary variables
    Index := 1;
    sIndex:=0; 
    NextSkip := Skip[sIndex];
    Initialized := True;
  end; 
//END OF INITIALIZATION

  if not Error then
  begin 
    while Index = NextSkip do
    begin
      Index := Index+1;
      sIndex := sIndex+1;
      if sIndex < Length(Skip) then
        NextSkip:=Skip[sIndex];
    end;
  
  
    Value := IntToStr(Index);
    if PADTO > 1 then
      while Length(Value) < PADTO do
        Value := '0'+Value;
    FileName := WideExtractBaseName(FileName) + Value + WideExtractFileExt(FileName);  
    Index := Index + 1;
  end;
end.

Last edited by krtek (2008-05-03 03:32)


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#4 2008-05-03 19:33

Inf
Member
Registered: 2008-05-02
Posts: 2

Re: Add not yet existing files (dummy file)?

Thank you. smile

I found the Import feature easier to understand and use than the long Pascal script, and works better for me.

However, ReNamer still outputs an error about files not being renamed. It works though.

Anyways, probably a suggestion here, but in the future, try to add this feature if possible and simple enough to code. A simple "virtual file" which I could insert. Like, right-click and "Insert Placeholder file" or something. Might be easier. smile

It's your call.

Btw... thanks for the quick support! smile

Offline

Board footer

Powered by FluxBB