Batch filename into txt

March 6, 2010 at 11:19:44
Specs: Windows 7
Hello, I hope this is the right section. To start off, I can't program/write a simple batch to save my own life, so I am here to beg for help.

I am trying to find a solution for our pipeline at work, we are working on animated show and our lighters reuse a base light scene that gets pasted into scenes folder...renaming/editing manually is easy enough, but very time consuming once you get into 100+ shots per episode . (so our structure looks like this)





so I have 2 questions.

Is there a fast way to rename each "wbl_tst_sc001.lws" to correspond to the correct scenes folder 2 parents up? Keep in mind the file structure is always the same. Not sure if a simple batch can do that.

My second question, and the more important one. Is it possible to then grab sc### part of the .lws file and paste it inside on it's own line at the end. (keep in mind .lws files can be edited in notepad/renamed to txt).

so if the file was wbl_tst_sc002.lws or wbl_tst_sc002.txt it would have a line at the end saying


I realize I may be asking a lot, but a programmer/TD is not in the budget at the moment and any help would be greatly appreciated.

Thank you kindly!


See More: Batch filename into txt

Report •

March 6, 2010 at 11:49:12
If I'm following you, you want:




Is that right?

Helping others achieve escape felicity


Report •

March 6, 2010 at 11:56:29
that would be correct :)

Report •

March 6, 2010 at 12:21:30
not tested! be SURE to run it "disabled" before enabling the script, otherwise you may crap up your system!
this is disabled. to enable/activate the script, remove the colons from the disabled lines 5 & 10.
if the test-run doesn't look right, or gives an error, post back with the results (error and/or sample output).

@echo off & setlocal
pushd x:\wbl_tst
for /f "tokens=3-5 delims=\" %%a in ('dir /s/b /a-d *.lws') do (
:: disabled for testing
::: ren %%a\%%b\wbl_tst_sc001.lws %%a.lws
set aa=%%a\%%b\%%a.lws
set xx=%%a
call :ff
goto :eof
set xx=%xx:~8%
echo ^>^> %aa% echo %xx%
:: disabled - enable the foll. for activation
::>> %aa% echo %xx%

Report •

Related Solutions

March 6, 2010 at 12:45:56
Most excellant, it renames perfectly!

Thank you for taking the time to work on this, only one issue.

Inside the .LWS it places "ECHO is off." at the end
so the last line looks like this.

x:\wbl_tst\wbl_tst_sc001\wbl_tst_sc001_jpg\wbl_tst_sc001_jpg.jpgECHO is off.

Report •

March 6, 2010 at 18:55:12
I will modify the script, i goofed! (apologies)
see my previous post - the script has been changed to fix.
set aa=%%a\%%b\%%a.lws
set xx=%%a
call :ff
goto :eof
set xx=%xx:~8%
>> %aa% echo %xx%

Report •

March 6, 2010 at 19:06:57 need to apoligise, you did me a huge favor!
works great now, thank you for putting the time into this! :)

Report •

Ask Question