find for renaming

From: bj (bj_at_nospam.fr)
Date: 02/01/05


Date: Tue, 01 Feb 2005 11:38:24 +0100

Hi,
I need some help with the command "find".

I want to rename several files in several directories.

for example :

./0001/123456.zip --> ./0001/myrenamedfile.zip
./0002/123456.zip --> ./0002/myrenamedfile.zip
...
./0999/123456.zip --> ./0999/myrenamedfile.zip

I try this but it doesn't work :

find . -maxdepth 3 -name "123*.zip" -exec mv {} "`dirname`
{}/myrenamedfile.zip" \;

or this :

find . -maxdepth 3 -name "123*.zip" -exec mv {} temp.zip \; -exec mv
temp.zip `dirname {}`/myrenamedfile.zip \; -print

I didn't manage to extract dirname and add it to my new name.

Any help is welcome,

Regards,

Bj



Relevant Pages

  • Re: ntfs.sys missing or corrupt
    ... indicated in this command. ... If the ntfs.sys file is there and corrupt it will rename it. ... not there then it was missing. ...
    (microsoft.public.windowsxp.general)
  • Rename a Computer
    ... Are there any Windows or Resource Kit tools to rename a computer from the ... command line. ... I don't want to use VBScript thanks. ... Regards ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Renaming a file in VB 6.0
    ... > I am trying to rename a file using VB 6.0. ... The command I am tried using ... > Thanks and Regards, ...
    (microsoft.public.vb.general.discussion)
  • Re: Great SWT Program
    ... a good tutorial on Unix CLI tools? ... command there, ... then rename everything in the search scope with the CLI, ... I'd have to boot up a Windows system and try stuff, ...
    (comp.lang.java.programmer)
  • Re: How To Make index.shtml As A Home Page?
    ... is the correct command, but will only be effective if AllowOverride All ... overridden (provided AllowOverride is set) using .htaccess as you have done. ... > DirectoryIndex index.shtml index.html index.htm index.php ... you should be able to open your online web in FrontPage and rename ...
    (microsoft.public.frontpage.client)