Find the answer to your Linux question:
Results 1 to 3 of 3
First ,I want to search the file I wanted Then,rename the file according to the folder directory. for example ./jizhen/wujizhen: 171 80 hupu.txt ./jizhen/wujizhen/171: 0000.txt 000100.txt 000101.txt 000102.txt hupu.txt then ...
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    3

    How to add a folder directory to rename the file

    First ,I want to search the file I wanted
    Then,rename the file according to the folder directory.
    for example

    ./jizhen/wujizhen:
    171
    80
    hupu.txt

    ./jizhen/wujizhen/171:
    0000.txt
    000100.txt
    000101.txt
    000102.txt
    hupu.txt

    then rename the "hupu.txt" to "hupujizhenwujizhen.txt" and "hupujizhenwujizhen171.txt"


    Thanks

  2. #2
    Linux User
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    262
    This sounds like a homework assignment to me.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    51

    Find command

    You might want to try the following, and be sure to lookup the syntax for find, you will notice, there are a number of different flags to help you with your homework assignment

    Code:
    find /jizhen/wujizhen -name hupu.txt -print -exec mv {} hupujizhenwujizhen.txt  \;
    This should give you a hint. Remember, this only does it for one file in that folder.

    You have to apply a level of logic so that when it finds the file in the right directory, it changes it according to your criteria.

    I hope this helps you.

    T

Posting Permissions

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