ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Automatic file renaming - Help needed with batch files

(1/1)

mediaguycouk:
Hi helpful and knowledgeable people of DC.

I have a processing problem with the satellite TV that I record here for languages at the university of southampton and it is mostly due to file names.

I have 4 pieces of software

Exterity IPTV http://www.exterity.co.uk/products_avedia.html
Video Redo http://www.videoredo.com/
Sorenson Squeeze http://www.sorensonmedia.com/products/?pageID=1#ppc2
Flash Media Server http://www.adobe.com/products/flashmediaserver/

I'm trying to make it so I don't have to re-encode 4-8 tv news recordings each day and make things automatic.

All these processes can be made automatic with the use of scheduled tasks and batch files but the names are a problem

Exterity outputs scheduled files as namechannel day month year.mpg
Video redo outputs files as input_fixed.mpg
Sorenson outputs files as input_VP6_1Mbps_Stream.flv

Nearly all of this is fine except for the date. I would need to rename the file namechannel day month year.mpg into 'namechannel.mpg'. Once that is done I can just use the rename command.

One line summary
So is there a program that can rename files that either works by 'rename namechannel*.mpg to namechannel.mpg' or works by saying 'rename namechannel $todaysDay $todaysMonth $todaysYear'.

Many thanks for the help that anyone can give.

Graham Robinson

mediaguycouk:
You know when you write a long post and then it gives you the inspiration to work out the answer. Well it worked for me and I'm sorry to waste anyone's time.

As it turns out Dos' rename command works fine.

rename NewsTVEiMonday*.mpg NewsTVEiMonday.mpg

Will turn
NewsTVEiMonday 10 12 07.mpg
into
NewsTVEiMonday.mpg

Making it perfect for generic batch scripts.

Graham

rjbull:
So is there a program that can rename files that either works by 'rename namechannel*.mpg to namechannel.mpg' or works by saying 'rename namechannel $todaysDay $todaysMonth $todaysYear'.
-mediaguycouk (December 11, 2007, 03:34 AM)
--- End quote ---

Suggest you run a command prompt and DIR > DIR.DIR.  Then redirect DIR.DIR through Horst Schaeffer's LMOD List MODifier and make a temporary batch file to cut out the bits you don't want.


LMOD 1.3 Filter (c) 2002 Horst Schaeffer
Syntax: LMOD options string_with_tokens
Options:
   /Ln[-m] line [range] to select (default: first non blank line)
   /L[n]*  all lines [starting n]
   /E      include empty input lines (default: no output)
   /S..    delimiters for word extraction, instead of default (,;=)
   /B..    as /S, but excluding blank space as delimiter
   /Nn     starting line number (for token [#]), default: /N001
Insert from source line (expression in square brackets):
 [p,l $n U|L Rn]  default []: complete line
   p,l     from position p, length l (default rest of line)
   $n      word number n ("!" for last word); optionally ñoffset
   $n:m    range of words by number (blank space will be inserted)
   U|L     convert to upper|lower case
   Rn      right aligned in output field of size n
Other tokens:
   [+]     insert CR+LF
   [-]     omit CR+LF at end of output
   [#]     line number (digits acc. to option, default:3)
   [=n]    tab to position n in output line
   [~n]    ASCII code n (decimal)
   [".."]  quoted char/string (use for redirection symbols)

--- End quote ---

Other option; run one of the renaming tools that can recognise the date strings and remove them, e.g. BKrenamer, which recognises regular expressions.

[edit]
<sigh>  I should take notice of the little warning that tells you someone else has posted while you were still typing...   :-[
[/edit]

wr975:
Edit: You solved it already... ;)

lanux128:
mediaguycouk, you may have solved your problem.. but just in case, i'd like to post a DC thread containing list of Renamers, maybe one would be useful to you in the future.. :)

• Review of File Renamers — let's make a list

Navigation

[0] Message Index

Go to full version