How add a prefix to file names? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How add a prefix to file names?

PeytonPeyton Atlanta, GeorgiaPosts: 2Member

I want to add the same prefix to a large number of files, all with the same extension, but all having long file names with spaces in them. I found the following code at http://www.lagmonster.org/docs/DOS7/z-ren1.html:

LFNFOR On
FOR %v IN (*.txt) DO REN %v abc%v.x
REN *.x *

When I try it without LFNFOR, I get an error message - not surprising since I didn't specify long file names.

However, when I key in LFNFOR, I get an error message just from typing that.

My PC is 64-bit Windows 7.

Thanks in advance for your help.

Answers

  • PeytonPeyton Atlanta, GeorgiaPosts: 2Member

    To clarify, the DOS commands I cited should appear on separate lines, and somehow got placed onto one when my question was posted:

    LFNFOR On
    FOR %v IN (*.txt) DO REN %v abc%v.x
    REN *.x *

  • PeytonPeyton Atlanta, GeorgiaPosts: 2Member

    It did it again! (There should be A carriage return after LFNFOR, and another one prior to REX *.x *)

  • IcepickleIcepickle GermanyPosts: 49Member

    You mean, like this?

    LFNFOR On
    FOR %v IN (*.txt) DO REN %v abc%v.x 
    REN *.x *
    

    (add a return, and four spaces per line for a code block)

Sign In or Register to comment.