#1 2015-07-29 12:56

merconi
Member
Registered: 2015-07-29
Posts: 2

Rename from first three letters in file contents

Hello,

I have several hundred text files. The contents of all files starts with (variable) three-digit number, and this number should be extracted and used to rename a file to be like "[number].txt".
Is there a way to do it in Renamer. I presume I would need PascalScript rule.

Please help.

Merco

Offline

#2 2015-07-29 19:03

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

Re: Rename from first three letters in file contents

Hi and welcome Merco,

you could take a look at our wiki and see if you could figure it out yourself:

ReNamer:Rules:PascalScript
ReNamer:Pascal_Script:Read_file_content

function FileReadFragment(const FileName: WideString; Start, Length: Integer): String;

begin
  FileName := '[' + FileReadFragment(FilePath, 0, 3) + '].txt';
end.

Else just ask for more help.
 


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 2015-07-30 11:53

merconi
Member
Registered: 2015-07-29
Posts: 2

Re: Rename from first three letters in file contents

Hello Stefan,

Thanks for the welcome.
And thank you very much for the PascalScript. It works!
It has renamed all files as I expected, giving them names from the first three letters in the text (three bytes), and my application works now.

Great tool!


Merco

Offline

Board footer

Powered by FluxBB