help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recursively move types of files


From: Peter Dyballa
Subject: Re: recursively move types of files
Date: Thu, 15 May 2008 14:06:09 +0200


Am 15.05.2008 um 02:22 schrieb Charles L. Snyder:

2. I have a huge number of files named like this
"Report_work_01232008_blah.pdf", and I want to replace all the "_"
with " "


It's probably better to do it outside dired-mode, in a *shell* buffer:

        find <directory> -type f -exec trans.sh {} \;

maybe added with a -name <pattern> option and a shell script trans.sh like:

        #!/bin/sh
        dir="`dirname $1`"
        fil="`basename $1`"
        new="`echo "$fil" | tr _ ' '`"
        mv "$1" "$dir/$new"

or in bash:

        #!/bin/bash
        dir=$(dirname $1)
        fil=$(basename $1)
        new=$(echo "$fil" | tr _ ' ')
        mv "$1" "$dir/$new"


--
Greetings

  Pete

When in doubt, use brute force.
                                – Ken Thompson







reply via email to

[Prev in Thread] Current Thread [Next in Thread]