![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Renaming multiple files | jayell | Shell Programming and Scripting | 5 | 02-27-2008 12:17 PM |
| Moving multiple files and renaming them on the fly | daemongk | Shell Programming and Scripting | 1 | 06-08-2007 10:36 AM |
| moving and renaming multiple files | rocinante | Shell Programming and Scripting | 1 | 06-07-2007 05:20 PM |
| Renaming multiple files | jxh461 | Shell Programming and Scripting | 4 | 04-01-2003 03:25 PM |
| renaming multiple files | piltrafa | UNIX for Dummies Questions & Answers | 6 | 11-10-2001 08:27 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Renaming multiple files
Help!
I was trying to rename multiple files. Like in DOS, i decided to use wildcards and now i am missing some files. Any ideas on how to recover them? Or find out where the files went? I had these 3 files resume1.log elecresume.log compresume.log The command I ran was mv *.log *.log.bak Now elecresume.log is missing but nothing happened to the other two files. Also no new files got created i.e., the *.log.bak files. Thanks in advance. |
| Forum Sponsor | ||
|
|
|
|||
|
mv works on 1 target at a time.
you cant specify multiple files unless you are moveing them to a directory. on my solaris 8 box. i get the following: Code:
$ ls *.log 1.log 2.log 3.log $ mv *.log *.log.bak mv: *.log.bak not found $ ls 1.log 2.log 3.log |
|
|||
|
If those are the only 3 files ending in .log in your directory, you could do this:
for i in `ls *.log`;do mv $i $i.bak done That would do each one individually but loop through the 3 files so you only have to do the one command. |
|
|||
|
you cant get it back unless you restore it from backup.
you shouldnt have lost the file in the first place the command should have failed per my example. mabey your os's mv command acts differntly then mine. my os: sol8 on sparc |