ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Coding Snack Guidelines

IDEA: files contents in folder to contents of a file- keep the same name


I've got a website I'm moth-balling, so all entrants to the site by a bookmark or favorite to a certain folder and file need to be redirected to the new file location.  I've created redirect html on the index pages.  Now I want to take a copy of the contents of the redirection code and put them in every file in the folder, but have the file names retained.

I was searching but couldn't find anything like this.  Has anybody come across anything that would do this?

One small problem...What would you name this if it gets created as a snack???  Maybe "Website Forwarder" but that's not very revealing of the actions this actuate.

I saw an icon that would fit nearly perfectly at Skrommel's page, this for ShortCutter.  Maybe putting the arrows in a tighter circle actually inside the the folder's boundaries.

And after re-reading (I originally thought you were talking about bookmarks saved in your browser, and maybe you are, I don't know for sure)...

If Apache is your web server you could use a mod_rewrite rule to redirect all accesses to the web server to a new location. The rule(s) would be placed in .htaccess. Google it for info.

But to copy a file to every folder could be easily done in BATCH or any scripting language ... To answer the question.


Yes when I said 'bookmarks and favorites' I was referring to those in the browser.  I've dealt with the .htaccess file only a handful of times but I want to use the redirect page I've already designed.  It's a slightly fancy html file that says to paraphrase 'this page has moved, please make new bookmarks when you land on the new page.  Redirecting in 25 secs.'

Actually, I've been working on an open source Bible, so the files in the folder are dGenesis.html, dExodus.html, dLeviticus.html, dNumbers.html, etc on down the line.  My hosting provides very good statistics, and many readers are entering the website in that particular folder by those file names.  Until a year or so ago, they were coming in on one of those more often than through the home index!  They are going to be redirected to the Table of Contents page for the Bible on the new website through the html redirect I've written.  I want to 'multiply' the one html redirect page into many with each of those file names.

I'd love a little program that allowed you to "Browse" to a file name in a box up top as the master file, and fill it's contents into every file in a folder I select, but keep the file names.

My proficiency in writing batch files doesn't make it in that regard.  Thanks though.  Have you or anyone heard of a program that would save me a lot of manual renaming?


[0] Message Index

Go to full version