win NT batch file renamer
Author
Discussion

Graham

Original Poster:

16,381 posts

314 months

Tuesday 31st January 2006
quotequote all
Hi, following on from my search and replace query which is now working thanks.

I now have a problem in renameing the files...

the files are jobvr04-123456^0797723412

if i pass that through the batch files the ^ is replaced with a null character so my programs dont work.

to get around that i get the output program to name them jobvr04-123456£0797723412

instead..

but once modified i then need to turn the filename back to jobvr04-123456^0797723412

the overall lenght of the file may vary as the last part is a telephone number but the ^ will always be a fixed position from the left..


Any ideas, anyone fancy knocking up a few lines of code for me

cheers

graham

zumbruk

7,848 posts

290 months

Tuesday 31st January 2006
quotequote all
rename 's/£/^/;' job*

(There should be a backslash in front of the up-arrow in this command line, but PH is removing it.)

(The "rename" program is available from CPAN or http://stason.org/works/scripts/rename.pl)

(Perl for Windows is available (for free) from Active State; www.activestate.com/)



>> Edited by zumbruk on Tuesday 31st January 15:43

Graham

Original Poster:

16,381 posts

314 months

Thursday 2nd February 2006
quotequote all
TA using perl was an option, but now i've managed to convice the software supplier that using ^ is a bad idea if you need to do any manipulation... nt uses as a marker in regular expressions and it invalid as a filename char in unix so at some point they were alwasys going to get an problem !!!

cheers

G