Append prefix only for files within specific folder name

Post any Bulk Rename Command support requirements here. Open to all registered users.

Append prefix only for files within specific folder name

Postby jyip » Fri Dec 22, 2017 4:03 pm

Looking to setup a scheduled task to append a prefix "Arch" to files that only reside in folders named "Archive" and ignore the rest using Bulk Rename Command.

A bonus would be if it already has the "Arch" prefix, to leave it as is.
jyip
 
Posts: 1
Joined: Fri Dec 22, 2017 3:57 pm

Re: Append prefix only for files within specific folder name

Postby bru » Wed Mar 27, 2019 6:42 pm

The below batch works, but note your folder-name match is case-insensitive.
It works recursively, but only in folders named archive, Archive, etc.
Files already beginning as Arch* will be left alone.

@echo off
For /f "delims=" %%A in ('dir/b/s/ad Archive*') DO @If /i "%%~nA"=="Archive" (
brc32 /Dir:"%%A" /NoFolders /Prefix:Arch /Regexp:"^(Arch)+(.*):Arch\2" /execute)
echo.
echo.
echo.Done, press any key to exit.
pause>nul
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Append prefix only for files within specific folder name

Postby groundswell » Fri May 22, 2020 3:10 pm

Thanks for the reply and help!

I ran the example you gave me and it ran without error but didnt seem to rename any of the files. Here's what I ran and screenshots below of results. I figured I will test manually first before creating a batch file.
C:\BRC\BRC64.exe /removename /appendfolder:P::1 /pattern:*.TXT /recursive

Image

Image
groundswell
 
Posts: 6
Joined: Thu May 21, 2020 5:24 pm


Return to BRC Support