Find the answer to your Linux question:
Results 1 to 5 of 5
Hi Team, I have around 150+ folders in one directory. All contains some pdf files. Now i want to give some prefix no. to folder only not the files inside. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    25

    Renaming Multipal Folders


    Hi Team,
    I have around 150+ folders in one directory. All contains some pdf files. Now i want to give some prefix no. to folder only not the files inside. How can i give the prefix to all my folders?

    Eg : OLD FOLDER NEW FOLDER
    ABC/ 8562-ABC/
    AABC/ 8562-AABC/

    Thank You,
    Parag Nehete.

  2. #2
    Linux User zenwalker's Avatar
    Join Date
    Feb 2010
    Location
    Inland Empire
    Posts
    293
    It looks like a job for PERL!

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    25
    Not necessary.....it can be done by shell script. But i dont knw scripting

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,763
    Did you checked rename command ?
    man rename
    Or else you can do a script a like
    #find . -type d -exec mv {} {}-new \;
    If you have a dir with sub-dirs named 1,2,3,4,5 and after running above command you will get 1-new,2-new,3-new,4-ne,5-new.
    Please modify them to meet your requirement.
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  6. #5
    Just Joined!
    Join Date
    Apr 2011
    Posts
    25
    Thanks Lakshmi.....its really useful but actually i want to give the same no to all folders. Eg. There are 10 folders in one directory (Folder-1,Folder-2.......Folder-10) so i want to add "8953" to all folders.(8953-Folder-1 , 8953-Folder-2......8953-Folder-10)

Posting Permissions

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