LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-09-2013, 11:54 AM   #1
pstein
LQ Newbie
 
Registered: Jan 2009
Posts: 13

Rep: Reputation: 0
How to move multiple files in ONE COMMAND to other dir?


Sorry for this question:

How do I move multiple files WITH ONE command (not through GUI) from one dir to another?

The following command does not work:

mv *.mp3 /var/www/backup/files/

Linux terminal tells me:
mv: call of stat for *.mp3 not possible: file or dir not found

How else does it work?

Related question: If I replace "mv" by "cp" in your solution: Does it work as well?
 
Old 10-09-2013, 12:06 PM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,174
Blog Entries: 10

Rep: Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980
What OS.build.platform are you dealing with?

Does
Code:
ls -1 *.mp3
return hits?
Are any mp3 files in use?

Code:
stat *.mp3
are they in the directory you are running the command in?

Try this experiment in an empty directory
(I use mp4 here in case valid file[n].mp3 exists in /var/www/backup/files/ already)
Code:
for i in `seq 1 5` ;do touch file$i.mp4 ; done
mv *.mp4 /var/www/backup/files/
Please let us know...
 
Old 10-09-2013, 04:30 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by pstein View Post
Sorry for this question:

How do I move multiple files WITH ONE command (not through GUI) from one dir to another?

The following command does not work:

mv *.mp3 /var/www/backup/files/

Linux terminal tells me:
mv: call of stat for *.mp3 not possible: file or dir not found
All that tells you is that there are no files that match "*.mp3" in the working directory.

Quote:

How else does it work?

Related question: If I replace "mv" by "cp" in your solution: Does it work as well?
It should get the same error if there are no files that match "*.mp3".

The wildcards on the command line are interpreted by the shell, not by the command. So expansion of "mv *.mp3 /var/www/backup/files/" would be the same as done for "cp *.mp3 /var/www/backup/files/".
 
1 members found this post helpful.
  


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
Move files contained in source dir to destination dir, but not source dir itself unixunderground Linux - Software 3 09-20-2013 12:17 PM
[SOLVED] Command to move file from one dir to another gingernate Linux - Newbie 6 08-20-2012 02:57 PM
Shell Script for Identifying the file and zip all files, move the files to Target Dir gvenkat Linux - Newbie 3 05-07-2011 11:53 AM
cp help, copying multiple doc files from multiple dir to one dir. How do i do that? w@m Linux - Newbie 5 02-03-2010 10:56 AM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 03:57 PM


All times are GMT -5. The time now is 05:00 AM.

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