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 ...
- 11-20-2011 #1Just 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
- 11-21-2011 #2Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
This sounds like a homework assignment to me.
- 11-21-2011 #3Just 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
This should give you a hint. Remember, this only does it for one file in that folder.Code:find /jizhen/wujizhen -name hupu.txt -print -exec mv {} hupujizhenwujizhen.txt \;
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


Reply With Quote