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

  • SEARCH
  • Home
  • 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 8531287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:27:00+00:00 2026-06-11T09:27:00+00:00

I have a directory with folder structure as follows: DATA — ABD 1231345 —

  • 0

I have a directory with folder structure as follows:

DATA -- ABD 1231345 -- 2012_01_08
                    -- 2012_03_09
                    -- 2012_06_11

     -- DEF 4859480 -- 2012_02_10
                    -- 2012_05_10
                    -- 2012_07_10

What I’m trying to do is:

  • cd DATA
  • run a bash script (while in /DATA) that will rename all first-child folders from

ABD 1231345

to

ABD_1231345

Do you have a suggestion on how to accomplish using command line on Mac OSX / unix?

  • 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-06-11T09:27:01+00:00Added an answer on June 11, 2026 at 9:27 am
    for i in *; do mv "$i" "${i// /_}"; done
    

    Note that the ${i//string/repl} syntax is a non-standard extension of sh, but you can do the same thing portably with something like:

    for i in *; do j=$( echo "$i" | tr ' ' _); mv "$i" "$j"; done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a directory structure as follows Client_Site/ some_folder1/ some_folder2/ some_folder3/ Lots of files
I have the following directory structure of a project: Folder project in Eclipse: --folder
Suppose I have the following directory structure in Vim's NERDTree: /some/folder/ |-apples.txt |-bananas.txt |-
I have a directory structure as follows: Projects -> Libraries -> Box2d -> Collision->
I am really confused i have a directory structure as follows. /foo/bar/project/ under project
I have a rename tool that sets a folder directory, however I created some
i have a list box and i want to add a folder/directory to that
i need to access folder in project .I have used Directory.CurrentDirectory and it is
If I have a development area that I deleted files from a certain folder/directory,
I have a folder in the root directory of a wordpress site. As such,

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.