change extension without previously selected files

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
atisoro
Posts: 29
Joined: 27 Jan 2025 16:27

change extension without previously selected files

Post by atisoro »

Is it possible to change the extension for all .txt files in a folder without selecting them manually?

in folder:
...\Test\fileA.txt
...\Test\file new.txt
...\Test\another file.txt

by code in
...\Test\fileA.rtf
...\Test\file new.rtf
...\Test\another file.rtf

?

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

Re: change extension without previously selected files

Post by highend »

As long as you're in the same path:

Code: Select all

$srcExt = "txt";
    $dstExt = "rtf";

    rename "e", $dstExt, , listfolder(, "*.$srcExt", 1), 64;
One of my scripts helped you out? Please donate via Paypal

atisoro
Posts: 29
Joined: 27 Jan 2025 16:27

Re: change extension without previously selected files

Post by atisoro »

highend: brilliant, like always.
I couldn't finish them.
:beer:

Post Reply