LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 03-06-2012, 11:00 AM   #1
Nitesh Agarwal
LQ Newbie
 
Registered: Sep 2011
Location: Rourkela
Distribution: Ubuntu
Posts: 4

Rep: Reputation: Disabled
Smile copy contents of many directories in a directory


I have a folder music which contains subfolders eminem, the beatles, ACDC,etc..... These subfolders contains .mp3 files.
How do i copy all these .mp3 files to a different folder collection using shell.

Last edited by Nitesh Agarwal; 03-06-2012 at 11:02 AM.
 
Old 03-06-2012, 11:04 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,755
Blog Entries: 1

Rep: Reputation: 238Reputation: 238Reputation: 238
Assume source directory is $HOME/music and destination directory is $HOME/new_music,
Code:
find $HOME/music -name '*.mp3' -exec cp {} $HOME/new_music/ \;
 
1 members found this post helpful.
  


Reply

Tags
bash scripting, commands, shell script, shell scripting, terminal


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files from multiple directories into one directory MadRabbit Linux - Newbie 8 02-07-2014 08:56 PM
Copy a directory without it's contents? davidstvz Linux - Newbie 5 11-06-2009 03:03 AM
Copy a directory without contents zefram Linux - Software 2 04-28-2009 06:06 PM
How to flatten contents of sub-directories down to one directory? jsstevenson Linux - General 3 09-13-2008 06:01 PM
How can I copy a directory and it's contents with CLI? CyberLord_7 Linux - General 2 03-30-2004 12:35 PM


All times are GMT -5. The time now is 07:34 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration