![]() |
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 |
| find the length of file names in a directory? | koti_rama | Shell Programming and Scripting | 5 | 06-04-2008 10:19 AM |
| Replace characters in all file names in a particular directory | madhunk | Shell Programming and Scripting | 4 | 02-16-2006 07:10 PM |
| directory names in a flat file | surjyap | Shell Programming and Scripting | 2 | 10-06-2005 07:51 AM |
| How to change automatically the file names | MAKY | Shell Programming and Scripting | 6 | 08-10-2005 10:47 AM |
| File and Directory Names become hidden | dbinsol1 | UNIX for Advanced & Expert Users | 10 | 05-29-2002 09:58 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Change All File Names in a Directory
Hi,
If I have a directory full of say 100 random files, and I would like to organize them, for example: FILE001, FILE002, FILE003, FILE004, etc. How would I do this from Terminal, instead of manually changing each file? I'm using Mac OS X, if that makes a difference. Thank you in advance for any help ![]() |
|
||||
|
multiple file renaming
say you have files like below...
jordba.package1 jordba.package2 jordba.package3 use the below: for f in jordba.*; do mv "$f" "${f#jordba.}"; done the above for loop will make your list like... package1 package2 package3 ======================== but there is another issue similar to the before that i have the files x1_p.sql x2_p.sql x3_p.sql and so on i need to add h before .sql to be as the following: x1_ph.sql x2_ph.sql x3_ph.sql ==================================== This should work for the data given by you above... for f in *_p.sql ; do mv "$f" "${f%_p.sql}_ph.sql"; done I hope these r helpful |
|
||||
|
Quote:
Sidenote: This is with .jpg files. I changed "FILE%03i" to "FILE%03i.jpg", so the two files came out: FILE002.jpg and FILE003.jpg. None of the other file names changed. |
|
||||
|
I'm not sure what to do with filename. I tried *.jpg and "*.jpg" and end up with: `*.jpg': not a valid identifier and `"*.jpg"': not a valid identifier, respectively.
|
|
||||
|
Quote:
However, I want to take randomly named files, such as qwerty.jpg, blah.jpg 123_lol.jpg, and rename them to be ordered sequentially, such as: 2007NOV03001.jpg, 2007NOV03002.jpg, 2007NOV03003.jpg, etc. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|