Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6999445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:32:31+00:00 2026-05-27T20:32:31+00:00

So basically, I have a folder with a bunch of subfolders all with over

  • 0

So basically, I have a folder with a bunch of subfolders all with over 100 files in them. I want to take all of the mp3 files (really generic extension since I’ll have to do this with jpg, etc.) and move them to a new folder in the original directory. So basically the file structure looks like this:

/…/dir/recup1/file1.mp3

/…/dir/recup2/file2.mp3

… etc.

and I want it to look like this:

/…/dir/music/file1.mp3

/…/dir/music/file2.mp3

… etc.

I figured I would use a bash script that looked along these lines:

#!/bin/bash
STR=`find ./ -type f -name \*.mp3`

FILES=(echo $STR | tr ".mp3 " "\n")

for x in $FILES
do
    echo "> [$x]"
done

I just have it echo for now, but eventually I would want to use mv to get it to the correct folder. Obviously this doesn’t work though because tr sees each character as a delimiter, so if you guys have a better idea I’d appreciate it.

(FYI, I’m running netbook Ubuntu, so if there’s a GUI way akin to Windows’ search, I would not be against using it)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:32:31+00:00Added an answer on May 27, 2026 at 8:32 pm

    If the music folder exists then the following should work –

    find /path/to/search -type f -iname "*.mp3" -exec mv {} path/to/music \;
    

    A -exec command must be terminated with a ; (so you usually need to type \; or ';' to avoid interpretion by the shell) or a +. The difference is that with ;, the command is called once per file, with +, it is called just as few times as possible (usually once, but there is a maximum length for a command line, so it might be split up) with all filenames.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have this application which scans through all mp3's in a folder and
I have a folder with about 1,700 files. They are all named like 1.txt
If I have example.com/dir and dir is basically a folder in the example.com server,
I want to make a program that moves certain named folders (and all files
Basically, I have a jar file that i want to unzip to a specific
I have an array of folders/files that looks like this: Array ( [Root Folder
I really hope someone can help me with this. Basically i have an issue
I have basically the following folder structure: Framework_Folder |__application | |_Models | |_views |
I have a folder /assets/animations filled with .swf files. I would like my AS3
I often find myself in a situation where I have a folder containing files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.