![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rename files help | piltrafa | UNIX for Dummies Questions & Answers | 2 | 10-04-2007 09:47 AM |
| Need help on installing an EASY to use and easy to install command line text editor | EugeneG | UNIX for Dummies Questions & Answers | 4 | 07-16-2007 11:53 AM |
| VI questions : mass changes, mass delete and external insert | Browser_ice | AIX | 1 | 12-13-2006 04:20 AM |
| Mass Change content in all files | terala | Shell Programming and Scripting | 1 | 11-20-2005 01:30 AM |
| Mass Copy/rename | lwilsonFG | UNIX for Dummies Questions & Answers | 6 | 11-03-2005 06:55 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Easy way to mass rename files?
Hi.
What is the easiest way to rename a bunch of files? For example taking all files ending in ".php3" and rename them to end in ".php" I could write a script to do this, but there is probably an easier way... Thanks! |
|
||||
|
Are you sure that you want to rename all *.php3 files to *.php files? Take into consideration that you need to alter the files themselves as well then, include()s and require()s for example.
Because I am lazy, I usually make Apache pass the *.php3 files to PHP4 as well, which always worked fine for me. HTH, Lexx |
|
||||
|
Yes, I am aware of that. But due to to way my site is designed that is not a big issue, in fact in the few cases where links would break I can do a grep and fix that.
But the rename php was merely an example, I am interested in ways to mass rename files... Thanks. |
|
||||
|
Releated to this so I'll add it here.....I've found it difficult to rename files to a truncation of the original filename....and you may find this too Thermopylae
i.e. if I have a bunch of files called random.temp.old and I want to rename then to random.temp (removing the .old)...then I get stuck. If I use a simple for script..... For the_file in *.temp.old do mv $the_file <<<<what can I use here>>>> done I want to use a shorter name - but don't want to have to get into the whole length of the filename and removing 'x' characters from the end of it...... is there a better way? ![]() |
|
||||
|
I can't think it without making that, either with "cut -c" command or with the awk command. I prefer awk with substr() and length() functions for the creation of the new_file_name.
It is becoming late for here. Greetings. Hugo. |
![]() |
| Bookmarks |
| Tags |
| awk, awk trim, linux, trim, trim awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|