Article 4QTQA Scripting question

Scripting question

by
kaplan71
from LinuxQuestions.org on (#4QTQA)
Hello --

I am writing a bash script that will copy a given list of folders in a source directory to a destination directory on an NFS mount.

Additionally, I want to include a conditional statement within the script that will check the destination directory for similarly named folders, and if it finds them, it will rename them with a date suffix. The goal being to avoid overwriting any folders at the destination.

The command that I have for renaming a given folder is the following:

Code:mv $foldername foldername_$(date +%d%b%Y)I don't what the correct syntax is for the conditional statement. Can someone provide information on this?

Thanks.latest?d=yIl2AUoC8zA latest?i=W1BPZdVIZbA:NTAfzoajTQI:F7zBnMy latest?i=W1BPZdVIZbA:NTAfzoajTQI:V_sGLiP latest?d=qj6IDK7rITs latest?i=W1BPZdVIZbA:NTAfzoajTQI:gIN9vFwW1BPZdVIZbA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments