Redmond morons strike again.

Don't use astericks in the pattern strings.

rename "%20" " " *.ext

Reply to
TCS
Loading thread data ...

In linux this is probably possible... can't say I've seen a command in DOS that will accomplish any equivalent. Perhaps it could be done with advanced batch file syntax, but has anyone ever officially "leanred" batch language? From what I've seen the wildcard symbols ? and * match ANY case, not sequential case. The easiest solution might be to make a small VB, C++ (check out MinGW32), or assembler program

formatting link
formatting link
to accomplish the task. Good luck.

-- "Perhaps it isn't that people are intentionally redefining standards, just that our logic is changing faster than our technology... or vice-versa." MCJ

20050109
Reply to
Mark Jones

I run under W2K and have a whole directory of files named "abc%20deXX.ext" that I need to rename as "abc deXX.ext" (i.e. chane the %20 to a space) with XX being 01 to 99.

Easy (I thought) : rename "abc%20de*.ext" "abc de*.ext"

Sure not. The result is "abc dedeXX.ext"

In the same vein rename "abc%20de??.ext" "abc de??.ext"

Creates one "abc dede.ext" for the first file and complains for the others the file name already exists.

Anyone having some idea?

--
Thanks,
Fred.
Reply to
Fred Bartoli

What does Redmond have to do with your programming problem? You might want to check the alt.msdos.batch.nt news group where your problem can probably be solved quickly.

Reply to
Si Ballenger

Reply to
Dennis Mchenney

In article , Mark Jones wrote: [...]

I know DOS batch stuff fairly well. There is little you can do in a batch file that you cant do by typing the commands. Perhaps the easiest thing to do is to:

dir /B *.ext >temp.bat

then edit temp.bat to make the commands needed.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

"Fred Bartoli" schreef in bericht news:421759d3$0$12425$ snipped-for-privacy@news.free.fr...

The same occured in W95 already and FAIK even in old DOS. Apparently wildcards cannot be reused (like in the copy and rename commands) if the characters they represent change place. So if you can live with three spaces instead of one you wil have no problem. Otherwise you will have to write some program (batch or other) that handles the files one at a time.

petrus bitbyter

Reply to
petrus bitbyter

"petrus bitbyter" a écrit dans le message de news:b6QRd.228264$ snipped-for-privacy@amsnews05.chello.com...

"abc%20deXX.ext"

others

spaces

After having searched for some time (yes, even the batch route), I've finally DL a file rename utility and done it in a snap.

Anyway, such a limitation in the wildcards use render them almost useless, and instead of pushing pseudo new technos that nobody need (except the processors & memory makers), they'd better implement some more fundamental features like this one. Rewriting the rename command is, I believe, within reach of at least one of their programmers (yes, I know, I'm an hopeless optimistic).

For the asked question, the problem isn't in my batch programming abilities or not, but in the parameter editing capabilities of the rename/copy commands. You simply *can't* do this for even one file, if you want to keep it general enough so that it works in a loop (I had hundreds of files to process) : their wildcard behave in a way that only an ill mind could conceive.

For the dir /b, yes I'm now thinking of a possibility, but what a pain, for what should be absolutely straightforward!

- create the filenames file.

- edit a copy, such as to replace the characters,

- use an editor with a full column mode capability

- add a rename column infront of each line of the old filenames

- add the column of the edited filenames at the end of the line

- run the batch.

And what if you want to automate this? You'll just have to write a small prog to handle what should stay at the scripting level...

Yeah, MS business is to simplify our lives...

and I stand by the Redmond morons...

--
Thanks,
Fred.
Reply to
Fred Bartoli

Try something like this: REN ABC?DE*.EXT ABC DE*.EXT I have not tried this, but i am ASSuMEing that the %20 is interpreted as one character. If not, ASSuME it gets interpreted as two characters and use two ??; if that fails then go for what you see as 3 characters.

Reply to
Robert Baer

"abc%20deXX.ext"

others

It won't work, because you assumed the same as me, and probably as lots of people:

The wildcards are just position matching but don't take any value. IOW they are local to the chain they're in and so don't allow you to transport its source value to the destination filename. This simply prevents you from inserting or deleting characters from inside the filenames. You can just overwrite the characters.

For example:

ren abcde* abc* will leave the filenames unchanged. Totally crazy!

--
Thanks,
Fred.
Reply to
Fred Bartoli

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.