Possible to create folders from file names?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Possible to create folders from file names?

Post by Schuller »

Works perfect!
Thanks again

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Possible to create folders from file names?

Post by Schuller »

When I create the folder from file, is it possible to have it so that it also duplicates not just the name and created date, but also the comments, tags and all the extra column data too from the file columns to the folder columns?

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

Re: Possible to create folders from file names?

Post by highend »

Sure...

Code: Select all

    setting "BackgroundFileOps", 0;
    foreach($item, <get SelectedItemsPathNames>, <crlf>, "e") {
        if (exists($item) == 2) { continue; }

        $cDate    = filetime($item, "c");
        $newPath  = gpc($item, "path") . "\" . gpc($item, "base");
        $metadata = "";
        $types    = "tag|cmt|lbl|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16";
        foreach($type, $types) {
            $metadata .= tagitems($type, , $item) . "|";
        }
        $metadata = trim($metadata, "|", "R");

        moveto $newPath, $item, , 2, 2, 2, 1, 0, 0, 1, 0, 0;
        timestamp "c", $cDate, $newPath;

        // Move metadata as well
        if (regexmatches($metadata, "[^|]")) {
            $i = 1;
            foreach($entry, $metadata) {
                $md   = gettoken($metadata, $i, "|");
                $type = gettoken($types, $i, "|");
                if ($md != "") { tagitems($type, $md, $newPath); }
                $i++;
            }
        }
    }
One of my scripts helped you out? Please donate via Paypal

Schuller
Posts: 184
Joined: 02 May 2023 21:08

Re: Possible to create folders from file names?

Post by Schuller »

Works perfect!
Thanks

Post Reply