From: Zaidy036@air.isp.spam   
      
   On 10/10/2020 3:31 PM, Zaidy036 wrote:   
   > On 10/10/2020 7:25 AM, Terry Pinnell wrote:   
   >> "Kerr-Mudd,John" wrote:   
   >>   
   >>> On Sat, 10 Oct 2020 09:02:39 GMT, Terry Pinnell    
   >>> wrote:   
   >>>   
   >>>> Terry Pinnell wrote:   
   >>>>   
   >>>>> I'm looking for a way to change all the extensions in a folder AND its   
   >>>>> subfolders. My batch skills have dropped over the decades from novice   
   >>> to   
   >>>>> almost non-existent so I'd much appreciate some help please.   
   >>>>>   
   >>>>> I do have the excellent tool Bulk Rename Utility but that applies   
   >>>>> filename changes at single folder level. My parent folder has   
   >>>>> scores of   
   >>>>> children (and quite a few grandchildren), so that would be tedious and   
   >>>>> time consuming.   
   >>>>>   
   >>>>> Specifically, I want all the *.ino files within say c:\docs\xyz to   
   >>>>> become *.txt.   
   >>>>>   
   >>>>> If it matters, I'm using Win 10 Pro.   
   >>>>>   
   >>>>> Terry, East Grinstead, UK   
   >>>>   
   >>>> I'd still like to see a BAT solution for comparison, but meanwhile   
   >>>> further googling gave me this neat method at a command prompt, with the   
   >>>> parent directory selected:   
   >>>>   
   >>>> for /R %x in (*.ino) do ren "%x" *.txt   
   >>>>   
   >>>> Terry, East Grinstead, UK   
   >>>>   
   >>>   
   >>> Well, to put it in a batch double the percents! Maybe stick an '@echo   
   >>> off' before it, if you don't want to see the results.   
   >>>   
   >>> Note that the rename will fail for 'example.ino' if there's already a   
   >>> 'example.txt' in the same directory.   
   >>   
   >> Thanks.   
   >>   
   >   
   > for /R %%x in (*.ino) do (   
   > if not exist %%x (   
   > ren "%%x" *.txt   
   > ) else (   
   > ren "%%x" *2.txt   
   > )   
      
   sorry, missed a step:   
      
   for /R %%x in (*.ino) do (   
   SET y=%%x:~,-3%.txt   
   if not exist %%y (   
   ren "%%x" "%%y"   
   ) else (   
   ren "%%x" *2.txt   
   )   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|