LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2004, 08:33 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 17.1 KDE on workstation, CentOS 6.x on servers
Posts: 1,119

Rep: Reputation: 46
rename command won't work


I'm trying to rename a file, but it just does not work. I type rename htaccess.txt .htaccess I don't get an error or anything, but if I do a dir it does not work, the file is still called htaccess.txt. Why is that? Is there an easy way around that?
 
Old 03-03-2004, 08:40 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Use 'mv'. I *despise* rename's syntax and it should only be used for complex multi-file renaming.

mv htaccess.txt .htaccess
 
Old 03-03-2004, 08:40 PM   #3
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
The rename command works the other way around Also, for single files I'd just use mv, rather than rename (which methinks is meant for renaming a group of files according to a Perl expression), thus

mv htaccess.txt .htaccess

Cheers, M.
 
Old 03-03-2004, 08:40 PM   #4
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
try mv htaccess.txt .htaccess

ummm....yeah...what they said...

Last edited by mikshaw; 03-03-2004 at 08:42 PM.
 
Old 03-03-2004, 08:53 PM   #5
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 17.1 KDE on workstation, CentOS 6.x on servers
Posts: 1,119

Original Poster
Rep: Reputation: 46
thanks for the quick answers!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to rename a file from command line ??? waelaltaqi Linux - Software 1 11-17-2005 01:49 PM
rename command or PERL perlexpr? malaka56 Linux - Software 1 08-24-2005 12:34 PM
rename reboot command coco03 Linux - General 6 04-19-2005 02:11 AM
rename with command line shanenin Linux - Software 1 09-25-2003 07:03 PM
rename file/folder command hct224 Linux - Newbie 4 09-19-2003 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration