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

Command Line special needs for Batch file - Replace/rename/remove in filenames

<< < (2/2)

Seems there are days when things just never go right. :huh:  Every time I get something to where I think it is right, hit Post and with for an Instant Retract That button  :-[

Yes, you are exactly right (oddly, you almost got the name right too :) ) It actually should end up more like:
1.               John


4.               Fred

6.               Julie

and so on.  Each name has at least one sub-site  some have as many as 10.
The "MYSITE.COM" just acts as a "host" for all the user's sub-sites.
Probably are better ways to do it but this is the way it was so I left the layout alone as it works.

The part of the code that reduce it to just the everything after the first 59 characters ends up with the name on the first line with the paths for that name's sites on each following line, then another name line.  That almost got me there.  At this point I should have done the deed with the extra spaces for a division as you show.

Then I found your trick for replacing a "\" with the "/"  by using using a double "\\" to simulate "\"  and replace it with "/".  I stuck that in and was so happy to see it worked that I almost did not notice it got to the end and started over again in the resulting text file.  I also ran into trouble trying to convert the Text to a DOC so that the links would actually work.  I guess even an RTF would have been enough.  I think I got lost in the middle parts where the inputs need to only be there until the output.  Too bad I cant use the input filename AS the output filename to save so many middle steps.

Somewhere in all this, I got into a loop (Surprise!) that ended up with FNR running for almost 3 minutes until finally stopping.  Not sure why it ran out of steam but it did.   The results though ended up doubled so I figured I was looping through at least twice.

By then I was ready to hang up my batch-hat and just edit the rest.
The trick there would be probably another length test.  the lines with just a name are always shorter by far than those after the name that have a full path
Easier to test for length than test for the "/" character.  But my eyes were getting blurry (again)  Allergies/Flu  who knows.  Either way, to  hard to see.

I was still trying to figure out the logic, gave up, posted what I had and went home to bed.
Thanks for your input as always.  It would help if I was even half as good at it as you are    ;) but I will try your latest in the morning and see how it goes.

Also  DUH  I will NOT screw up my next code post, I saw those two start-end boxes in the prview but I figured they would merge in the final.
I See now though.

Also  DUH  I will NOT screw up my next code post, ...-questorfla (February 17, 2014, 12:13 AM)
--- End quote ---

Yeah sure, I believe you ...  ::)



[0] Message Index

[*] Previous page

Go to full version