prefixing foldername before folder files

Discuss and share scripts and script files...
Post Reply
kotlmg
Posts: 321
Joined: 30 Jun 2010 17:14

prefixing foldername before folder files

Post by kotlmg »

hello sir,
i want to prefix folder name before folder files.
can it be done with script ? or batch rename?
my data is as follows
folder1
CBSE Class 10 Marking Scheme 2019 _ askIITians.pdf
hindi-course-b-2017-sa2-questions.pdf
mathematics-set3-2017-sa2-solutions.pdf
social-science-set3-2017-sa2-questions.pdf
folder2
mathematics-set3-2017-sa2-questions.pdf
social-science-set3-2017-sa2-solutions.pdf
social-science-set3-2017-sa2-questions.pdf

final result should be
folder1
folder1-CBSE Class 10 Marking Scheme 2019 _ askIITians.pdf
folder1-hindi-course-b-2017-sa2-questions.pdf
folder1-mathematics-set3-2017-sa2-solutions.pdf
folder1-social-science-set3-2017-sa2-questions.pdf
folder2
folder2-mathematics-set3-2017-sa2-questions.pdf
folder2-social-science-set3-2017-sa2-solutions.pdf
folder2-social-science-set3-2017-sa2-questions.pdf




with regards,
m.k.rao

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

Re: prefixing foldername before folder files

Post by highend »

Code: Select all

    $files = quicksearch("/f", , , "s");
    foreach($file, $files, <crlf>, "e") {
        renameitem(trim(gpc($file, "parent"), ":") . " - " . gpc($file, "file"), $file);
    }
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 321
Joined: 30 Jun 2010 17:14

Re: prefixing foldername before folder files

Post by kotlmg »

excellent sir.
thanks a lot.
it is perfectly working.

Post Reply