Help Make this Scrip Better

Discuss and share scripts and script files...
Post Reply
saltandpepper
Posts: 2
Joined: 21 Jun 2026 16:08

Help Make this Scrip Better

Post 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.

highend
Posts: 14956
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Help Make this Scrip Better

Post 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;
    }
One of my scripts helped you out? Please donate via Paypal

saltandpepper
Posts: 2
Joined: 21 Jun 2026 16:08

Re: Help Make this Scrip Better

Post 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;
    }
Last edited by saltandpepper on 27 Jun 2026 22:54, edited 2 times in total.

Post Reply