Bash Script to rename or remove punctuation (? !) & string in filenames of files, subdirectories and directories recursively in Ubuntu 16.04

Spread the love

I am new to using Bash scripting, but I have discovered a few solutions that use it to either remove or rename the filename for files within directories and sub-directories in Ubuntu 16.04. For example, my file structure is shown below. So, the FolderFruit,,, is the filename of our main directories. SubFolderApple???. SubFolder!!!Kiwi and SubFolder_Food_Banana are the filenames of our subdirectories. ListAppleFood, ListKiwiFood, and ListBanana are the filename of our individual files.








The goal is to change the filenames above into as shown below.








So far, I manage to script it as below, but it is not working. Thus, I would like to get help from any experienced Bash or Linux users.
shopt -s globstar for f in ./**; do sed ‘s/([[:punct:]])/\1/g’ “$f” done

X ITM Cloud News


Leave a Reply

Next Post

NVIDIA GTX1060 thermal throttling

Fri Sep 11 , 2020
Spread the love          I am fairly new to Ubuntu, so please bear with me. My job requires me to train machine learning models on a daily basis using my GPU. I am 100% sure now that I am suffering from heat throttling. My laptop super heats and the performance gets 4x […]

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware