Shell Script to Rename & Move files in Unix

Problem Statement: I have few files in source directory. I have to move them to another destination directory. The source directory have *.txt files that needs to be moved to destination directory. The destination filename should be *.txt.backup. So how to accomplish the above task in Unix Shell Script? Well the solution is simple:
cd source/ for file in *.txt do mv "${file}" ../destination/"${file}.backup"
Code language: Arduino (arduino)
Run a loop for each txt file in source/ directory and call mv command with parameters. Does the above problem have a simpler solution than this?

View Comments

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

5 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

5 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

5 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

5 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

5 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

5 years ago