The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 7 01-12-2009 04:27 PM
Moving multiple files and renaming them on the fly daemongk Shell Programming and Scripting 1 06-08-2007 01:36 PM
moving and renaming multiple files rocinante Shell Programming and Scripting 1 06-07-2007 08:20 PM
Renaming multiple files jxh461 Shell Programming and Scripting 4 04-01-2003 06:25 PM
renaming multiple files piltrafa UNIX for Dummies Questions & Answers 6 11-10-2001 12:27 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-25-2004
rmayur rmayur is offline
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.
  #2 (permalink)  
Old 02-25-2004
Optimus_P Optimus_P is offline Forum Advisor  
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
  #3 (permalink)  
Old 02-25-2004
rhfrommn rhfrommn is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2003
Location: Minnesota
Posts: 422
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.
  #4 (permalink)  
Old 02-25-2004
rmayur rmayur is offline
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?
  #5 (permalink)  
Old 02-25-2004
Optimus_P Optimus_P is offline Forum Advisor  
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
  #6 (permalink)  
Old 02-25-2004
rmayur rmayur is offline
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.
  #7 (permalink)  
Old 02-26-2004
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

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
Sponsored Links
Closed Thread

Bookmarks

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0