Bigger bug in Help fileMatch - broken time

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Bigger bug in Help fileMatch - broken time

Postby chrisjj » Thu Jul 10, 2025 3:23 pm

Code: Select all
// Step 1: get “Username = Alice” from file

line = fileMatch('^Username = .*');

// Step 2: split and trim to get “Alice”

username = line ? line.split('=')[1].trim() : null; // username set to "Alice"

// Example: extract values from EML file and use for a new name
// 1) grab the entire header line

rawDate = fileMatch('^Date:\s*.*',    'i'); // e.g. "Date: Tue, 08 Jul 2025 15:30:00 +0000"

rawSubject = fileMatch('^Subject:\\s*.*', 'i'); // e.g. "Subject: Meeting Reminder"

// 2) split on “:” and trim to get only the value

dateValue    = rawDate    ? rawDate.split(':')[1].trim()    : null;

subjectValue = rawSubject ? rawSubject.split(':')[1].trim() : null;
// 3) Combine into newName

combined = dateValue + '_ ' + subjectValue;

newName = combined.trim();


This

Code: Select all
dateValue    = rawDate    ? rawDate.split(':')[1].trim()    : null;


gives a faulty date

Code: Select all
Tue, 08 Jul 2025 15


because it erroneously includes the hours.
chrisjj
 
Posts: 44
Joined: Wed Mar 30, 2011 5:26 pm

Return to Suggestions