Page 1 of 1

Help Make this Scrip Better

Posted: 21 Jun 2026 16:13
by saltandpepper
Hi,

I made this script but it doesn't work as well as I want it to. Can someone help make it better?

I want to make sure the script only renames the selected files only, and also to make sure it includes the correct modified date information and hash information correctly:

Code: Select all

// Select all files

sel f;

// Rename each file with the current folder name, a [space], and followed by a CRC32 string.
   foreach($entry, "<get SelectedItemsPathNames>", "<crlf>") {
      rename b, "<curfolder> ". formatdate(<datem>, "yyyymmddhhmm "). hash(crc32, $entry, 1), , $entry;
   }
Appreciate the help.

Re: Help Make this Scrip Better

Posted: 21 Jun 2026 19:27
by highend
it includes the correct modified date
From each file or from the current time when executing the script?

If the current was meant, this should work a 100%:

Code: Select all

    setting "BackgroundFileOps", 0;
    $date  = formatdate(<datem>, "yyyymmddhhmm ");
    $files = formatlist(<get SelectedItemsPathNamesSlashed>, "f", <crlf>, "!*\");
    foreach($entry, $files, <crlf>) {
        rename "b", "<curfolder> " . $date . hash("crc32", $entry, 1), , $entry;
    }

Re: Help Make this Scrip Better

Posted: 27 Jun 2026 18:51
by saltandpepper
Thanks for the help. It would be from each file.

Update:

I think I figured it out. Let me know if there's something better, but here it is in case it helps someone else.

Code: Select all

    setting "BackgroundFileOps", 0;
    $date  = "";
    $files = formatlist(<get SelectedItemsPathNamesSlashed>, "f", <crlf>, "!*\");

    foreach($entry, $files, <crlf>) {
    $date = formatdate(property("#3", $entry), "yyyymmddhhmm ");
    rename "b", "<curfolder> " . $date . hash("crc32", $entry, 1), , $entry;
    }