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
rename a lot of files again ajp7701 Shell Programming and Scripting 11 03-31-2008 07:36 PM
rename files help piltrafa UNIX for Dummies Questions & Answers 2 10-04-2007 09:47 AM
trying to rename the files in dir hankooknara Shell Programming and Scripting 8 07-02-2007 03:36 AM
rename many files fsmadi SUN Solaris 4 04-30-2007 11:27 AM

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 05-12-2002
CompuTelSystem CompuTelSystem is offline
Registered User
  
 

Join Date: May 2002
Location: NL
Posts: 5
Lightbulb How to rename files?

How can i rename a file 'x.log' to 'x_20020512 072909.log'

i'm using perl, with system command from a unix web server, and need to timestamp my logs if the above format (filename _ year month day hr min sec .log)
  #2 (permalink)  
Old 05-13-2002
annececile's Avatar
annececile annececile is offline
Registered User
  
 

Join Date: Nov 2001
Location: Paris, France
Posts: 42
You can do:
system "mv x.log x_`date +%Y%m%d%H%M%S`";
Be careful, it is not quote but contrequote !!!
It is working for me.
Good luck !!
  #3 (permalink)  
Old 05-13-2002
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 499
Care: "x_20020512 072909.log"
Aviod using spaces within file names if possible.
  #4 (permalink)  
Old 05-14-2002
CompuTelSystem CompuTelSystem is offline
Registered User
  
 

Join Date: May 2002
Location: NL
Posts: 5
Unhappy

Quote:
Originally posted by annececile
You can do:
system "mv x.log x_`date +%Y%m%d%H%M%S`";
Be careful, it is not quote but contrequote !!!
It is working for me.
Good luck !!

Used copy&paste for it, but it won't work
  #5 (permalink)  
Old 05-14-2002
annececile's Avatar
annececile annececile is offline
Registered User
  
 

Join Date: Nov 2001
Location: Paris, France
Posts: 42
I try this on a SUN OS 5.7.
What is the result or the error ?
If it is only on the date, the best way to adjust this to your system is to do "man date" !!!
Do you try this command in your shell before scripting (without system !!) ?
  #6 (permalink)  
Old 05-14-2002
CompuTelSystem CompuTelSystem is offline
Registered User
  
 

Join Date: May 2002
Location: NL
Posts: 5
i don't get an error, the script runs on my ISP's server, but it seems the MV command is'nt working there.... (did try to rename aa to bb: nothing...

i'm using win:XP on my sys, can't test it here

(i'm using MSN, ICQ, AIM and YAHOO! messenger...)
  #7 (permalink)  
Old 05-14-2002
annececile's Avatar
annececile annececile is offline
Registered User
  
 

Join Date: Nov 2001
Location: Paris, France
Posts: 42
What is the OS of your ISP server ? Can you do a telnet on it ?
Closed Thread

Bookmarks

Tags
linux

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 11:13 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