Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-15-2008, 03:26 PM   #1
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 03:28 PM.
Old 07-15-2008, 03:31 PM   #2
Registered: Sep 2007
Distribution: debian based
Posts: 305

Rep: Reputation: 30
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, 08:32 PM   #3
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
man mv
Old 07-17-2008, 03:54 AM   #4
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
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, 08:39 AM   #5
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
mkdir images/personal
before doing anything else. And of course it has to be
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 06:27 AM.


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

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

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