s c h e m a t i c s : c o o k b o o k

/ Cookbook.FileRenameRecursive

This Web


WebHome 
WebChanges 
TOC (with recipes)
NewRecipe 
WebTopicList 
WebStatistics 

Other Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Schematics


Schematics Home
Sourceforge Page
SchemeWiki.org
Original Cookbook
RSS

Scheme Links


Schemers.org
Scheme FAQ
R5RS
SRFIs
Scheme Cross Reference
PLT Scheme SISC
Scheme48 SCM
MIT Scheme scsh
JScheme Kawa
Chicken Guile
Bigloo Tiny
Gambit LispMe
GaucheChez

Lambda the Ultimate
TWiki.org

Renaming Files Throughout a Directory Tree

Problem

You need to rename files throughout an entire directory tree, for example, you want to change extension of every file with a particular extension to something else.

Solution

A PLT-specific solution: 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

Discussion

I wrote this solution to use for-each because the rename operation is a side effect. You could also use fold-files, which isn't quite as good a fit because it accumulates a result, but the definition is a bit more concise. It also doesn't explicitly build up a list of files to modify first, which can amount to a lot of memory on a big directory tree.

500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

For a really correct


Comments about this recipe

Contributors

-- GordonWeakliem - 13 Aug 2004

CookbookForm
TopicType: Recipe
ParentTopic: FileRecipes
TopicOrder: 999

 
 
Copyright © 2004 by the contributing authors. All material on the Schematics Cookbook web site is the property of the contributing authors.
The copyright for certain compilations of material taken from this website is held by the SchematicsEditorsGroup - see ContributorAgreement & LGPL.
Other than such compilations, this material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest