1.

Solve : Batch Programming Help - Renaming Files?

Answer»

So, I'm new to writing Batch files. I've got the basic algorithm, however it is the formatting and language I'm having problems with.

I'm trying to write a file that replace that will, for each and every text file found in "C:\files\" folder, SWITCH it's file name with it's content.

E.g. "file1.txt", "file2.txt", "file3.txt", and "file4.txt" exist in "C:\files\" folder. In "file1.txt" there is a line of text containing the single word "alpha". The other text files have DIFFERENT words as content.
       "file1.txt" containing the word "alpha" becomes "alpha.txt" containing the word "file1".

-------------------------------------------------------------------------------------------------------------------
Here's my go at it:


FOR /R %%F IN (*.txt) DO (
SET /p var= RENAME %%F %var%
%%F > (*.txt)
)

-------------------------------------------------------------------------------------------------------------------


It's not working and for the LOVE of all that is holy, I can't get my head around it.


NOW...if I can get it to switch file names back AND forth using the same batch file......

I would be so gracious as to even GIVE you an internet hug...., their not cheap y'know..?
I swear to god I just saw this same question on another forum the other day.

A yes here it was.  It is even you.
http://www.dostips.com/forum/viewtopic.php?f=3&t=2937What's the purpose of your post - it's obviously been answered elsewhere?Yeh, the guys at DOStips were really helpful. I had posted this on multiple forums trying to get some help. I've got the file working though and this thread is closed.

Thanks guys.



Discussion

No Comment Found