#1 2012-10-25 18:01

shallcro
Member
Registered: 2012-10-25
Posts: 1

Command line option - equivalent to "Export file paths and undo paths"

Greetings;

For automating large jobs, I often call ReNamer from the command line, employing a preset file with my renaming options.

This approach works great, but I would like to save a log file with the original and new paths for files as a record of the renaming action (something like the .CSV file produced by the "Export file paths and undo paths" option under the GUI's Export menu).

I know there are no command-line options for this--would anyone have an idea how to accomplish this with a Pascal script? I've been making some feeble attempts but know nothing about Pascal...

Other possibilities? I have toyed with the idea of creating a hash of all files before renaming and then again after and then matching ... but that seems like ridiculous overkill ...

Thank you, collective wisdom!

Mike

Offline

#2 2012-10-30 14:09

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: Command line option - equivalent to "Export file paths and undo paths"

This is not exactly what you are asking for but it might do the trick.

Puting this script as the last rule will save the original path and the name as it was generated by the previous rules.

You can change the csv_dir, that is where the "csv" will be saved

I'm not very sure about calling it CSV though roll

You can give it a try:

const
  csv_dir = 'C:\';

var
  csv_file, timestamp, row: WideString;
  init: Boolean;

begin
  if (not init) then
  begin
    init := True;

    // Adding the date just to make the names somehow unique
    // Use the second (commented) one for more readable dates
    timestamp := IntToStr(DateTimeToUnix(Now));
    // timestamp := FormatDateTime('yyyymmddhhnnsszzz', Now); 

    csv_file := csv_dir + '\renamelist' + timestamp + '.csv';
  end;

  row := '"' + FilePath + '", "' + FileName + '"' + #13#10;
  FileWriteContent(csv_file, row);
end.

Last edited by SafetyCar (2012-10-30 14:10)


If this software has helped you, consider getting your pro version. :)

Offline

Board footer

Powered by FluxBB