The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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
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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-25-2004
Registered User
 

Join Date: Feb 2004
Posts: 3
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.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-25-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
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
Reply With Quote
  #3 (permalink)  
Old 02-25-2004
Registered User
 

Join Date: Nov 2003
Location: Minnesota
Posts: 387
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.
Reply With Quote
  #4 (permalink)  
Old 02-25-2004
Registered User
 

Join Date: Feb 2004
Posts: 3
I understand that now. But I am trying to find out what happened to the one log file that is now missing. Is there any way to find out where it went? Most importantly, can it be recovered?
Reply With Quote
  #5 (permalink)  
Old 02-25-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
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
Reply With Quote
  #6 (permalink)  
Old 02-25-2004
Registered User
 

Join Date: Feb 2004
Posts: 3
i am using FreeBSD. but yeah looks like that file is gone forever.
Thank you all for the information you provided.
Reply With Quote
  #7 (permalink)  
Old 02-26-2004
oombera's Avatar
Have a day :|
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Maybe before you completely give up, you could try searching for the files since maybe your "mv" command is doing something unusual instead of displaying an error. But like Optimus, my system displays an error too.

find / -name "elecresume*" -print

find / -name "*.log.bak" -print
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
solaris

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0