LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 10:54 AM   #1
pstein
LQ Newbie
 
Registered: Jan 2009
Posts: 14

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, 11:06 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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, 03:30 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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 11:17 AM
[SOLVED] Command to move file from one dir to another gingernate Linux - Newbie 6 08-20-2012 01: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 10: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 09:56 AM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM

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

All times are GMT -5. The time now is 11:27 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