I'm trying to create a bat file to remove -en-us from this mutiple files:
ie. monthly sales and cancellations-en-us.pdf would be renamed to monthly sales and cancellations.pdf.
This script below would work on local machine. However, if I define a filesharelocation which is a shared drive, and run it then I got this error:
File Not Found The system cannot find the file specified.
Below is the script i'm using:
@echo off
setlocal enabledelayedexpansion
set deletestring=-en-us
set filesharelocation=\\companyname\DEV\Testing
for /f "delims==" %%F in ('dir %filesharelocation% /b /l *-en-us.pdf ^| find "%deletestring%"') do (
set oldfilename=%%F
set newfilename=!oldfilename:%deletestring%=!
Ren "!oldfilename!" "!newfilename!"
)
Could anyone help? Thanks.