LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 07-15-2008, 02:26 PM   #1
generalachoo
Member
 
Registered: Jul 2006
Posts: 56

Rep: Reputation: 15
help: mv command with *.jpg extension


Hi. I have a folder with a bunch of .jpg images. I want to move all files with extension .jpg to another directory.

I did:

# mv '*.jpg' images/personal

but that yields an error saying no such directory

EDIT: Wow I feel stupid: no quotes are required.

Last edited by generalachoo; 07-15-2008 at 02:28 PM.
 
Old 07-15-2008, 02:31 PM   #2
tommytomthms5
Member
 
Registered: Sep 2007
Distribution: debian based
Posts: 308

Rep: Reputation: Disabled
i can also write up a simple script to rename those files witch saves time if you have over 100 of them

(note to tink: i'll keep it safe this time)
 
Old 07-16-2008, 07:32 PM   #3
shridhar005
Member
 
Registered: Jul 2008
Posts: 90

Rep: Reputation: 17
hey buddy which Distro you are using?
Also have mentioned source and destination properly.
better way read
Code:
man mv
 
Old 07-17-2008, 02:54 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
As you found out if you remove those single quotes it will work, that's because the single quotes mean take the following literally without any special meaning. The problem is that * does have a special meaning, it is a wildcard, if you put it in single quotes it tries to find a file called *.jpg not all the files that match the ending of .jpg.

You don't need a script to rename, simply use 'rename'.
 
Old 07-18-2008, 07:39 AM   #5
FranDango
Member
 
Registered: Jun 2008
Posts: 101

Rep: Reputation: 15
The 'no such directory' error could also mean that you don't have a target directory named 'images/personal' - in that case run
Quote:
mkdir images/personal
before doing anything else. And of course it has to be
Quote:
mv *.jpg images/personal
(no single quotes and no hash mark if it's used in a script).

Linux Archive

Last edited by FranDango; 09-20-2008 at 05:27 AM.
 
  


Reply



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
command to know the file extension type shivanrathore Linux - Newbie 11 06-16-2008 01:39 PM
HELP! BASH - Convert filenames from dsc00***.jpg to *.jpg jimmybond01 Programming 9 05-08-2007 06:17 AM
php command for jpg barrythai Mandriva 1 08-02-2005 04:16 AM
command extension huno Linux - Software 2 12-18-2004 08:59 AM
renaming all JPG to jpg quickk Linux - Newbie 8 09-05-2004 01:23 AM

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

All times are GMT -5. The time now is 11:02 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
Open Source Consulting | Domain Registration