[Solved]Set comment of parent folder to all the files inside

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
xen
Posts: 52
Joined: 27 Mar 2013 03:57

[Solved]Set comment of parent folder to all the files inside

Post by xen »

Hi
I have many folders ,each folder has it own comment (comment tag)
I want to set these comment to all files inside these folder (include all files inside its subfolder)

for example
folder E:/A1 has comment "a1"
folder E:/A2 has comment "a2"
folder E:/A3 has comment "a3"
all files in folder and subfolder of A1 (like E:/A1/Files1.jpg , E:/A1/Subfolder/Files2.txt) would be set comment "a1"
The same as above, all files in folder and subfolder of A2 would be set comment "a2"
all files in folder and subfolder of A3 would be set comment "a3"
I 'm very grateful if somebody can make a script do it, like this :
The user select multiple folders and run the script ,the script would set the proper comment to all the files inside those folder
Any help would be much appreciated
Thank you
Last edited by xen on 08 May 2016 09:51, edited 1 time in total.

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

Re: Set comment of parent folder to all the files inside the

Post by highend »

Code: Select all

    foreach($item, "<get SelectedItemsPathNames |>") {
        if (exists($item) != 2) { continue; }
        $comment = tagitems("comment", , $item);
        if !($comment) { continue; }
        $files = quicksearch("/f", $item, "|");
        if ($files) { tagitems("comment", $comment, $files); }
    }
One of my scripts helped you out? Please donate via Paypal

xen
Posts: 52
Joined: 27 Mar 2013 03:57

Re: Set comment of parent folder to all the files inside the

Post by xen »

highend wrote:

Code: Select all

    foreach($item, "<get SelectedItemsPathNames |>") {
        if (exists($item) != 2) { continue; }
        $comment = tagitems("comment", , $item);
        if !($comment) { continue; }
        $files = quicksearch("/f", $item, "|");
        if ($files) { tagitems("comment", $comment, $files); }
    }
it works perfectly ,thank you very much, highend :)

Post Reply