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.
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.