Re: rename files
From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 09/08/04
- Next message: Dana French: "Re: Checking whether my user-id is expired"
- Previous message: d0x: "rename files"
- In reply to: d0x: "rename files"
- Next in thread: Chris F.A. Johnson: "Re: rename files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 08 Sep 2004 14:10:09 GMT
2004-09-08, 09:57(-04), d0x:
> can any one help me out with this. I know somebody must have done it
> already.
>
> i have a directory with 901 files in it.
> i need a script the renames the files. basically i need it to take
> anything that is not a number,letter, or "." and change it to an "_".
>
> ie. "Charlie's Root.zip" - will become "Charlie_s_Root.zip"
[...]
Use zsh4.
autoload -U zmv # if not already in ~/.zshrc
cd /directory
zmv -n '(**/)(*)' '$1${2//[^.[:alnum:]]/_}'
Remove "-n" if you're happy with what zmv is going to do.
-- Stephane
- Next message: Dana French: "Re: Checking whether my user-id is expired"
- Previous message: d0x: "rename files"
- In reply to: d0x: "rename files"
- Next in thread: Chris F.A. Johnson: "Re: rename files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]