Find the answer to your Linux question:
Results 1 to 2 of 2
Hallo, I Have an urgent Problem and im not very expirianced with what I am doing. I have thousends of folders wit names like (before) _Xyz Hallo thats aFolder & ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2005
    Posts
    1

    Renaming Folders with spaces and have logging


    Hallo,

    I Have an urgent Problem and im not very expirianced with what I am doing.

    I have thousends of folders wit names like
    (before)
    _Xyz Hallo thats aFolder & so on_1232_jhgq_____

    on a windows system (sorry)
    all I can use is cygwin or ant or other win based tools to

    rename all folders to something like
    (after)
    Xyz Hallo thats aFolder & so on

    ( ls | cut -d"_" -f2 | sed -e "s/ //" #looks good)


    and sort them into folders ABC , DEF , .... , 1-9 ......
    depending on the new first character of the new name
    and have a logfile with oldname destinatinfolder/newname

    Problems:
    1. the spaces in the folder names seems to be a problem with cygwin a cd seems to work fine but if I use mv it cant find the source path. The same happens if I try to set Varaibles.

    2. If I try just to create folders with names I create from a textfile where I did the renaming it makes folders with names to all words
    (result)
    Xyz
    Hallo
    thats
    aFolder
    &
    so
    on

    What is not very usefull.

    Does anyone have an idea how to do that.

    or

    does anyone know how to mix ant task for renaming or Copydir
    with cut, sed and an for each statement from a txt file?

    or

    is there any other solution I m not able to figure oute with my limited brain

    cu
    tigger2

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    This sounds too convoluted to not be homework...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •