Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Renaming Folders with spaces and have logging


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

    I have thousends of folders wit names like
    _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
    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

    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

    What is not very usefull.

    Does anyone have an idea how to do that.


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


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


  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    St. Petersburg, FL
    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