Extra characters after folders that I used the date function to name it
by alexthelion335 from LinuxQuestions.org on (#540EP)
I am trying to automatically backup my Minecraft server, but I am having issues with naming the folders the current date
Code:echo Making directory named "$(date +"%B %d %Y")"
mkdir /home/alex/spigotBackup/"$(date +"%B %d %Y")"
echo Copying data to folder...
cp -r /home/alex/spigotMC/TwentyTwenty* /home/alex/spigotBackup/"$(date +"%B %d %Y")"
cp -r /home/alex/spigotMC/plugins /home/alex/spigotBackup/"$(date +"%B %d %Y")"
cp -r /home/alex/spigotMC/logs /home/alex/spigotBackup/"$(date +"%B %d %Y")"
echo Done!But when I list the directory I get this(the ones with the extra characters are the ones created with the batch file):
Code:'April 1 2020'
'April 13 2019'
'April 16 2020'
'April 19 2019'
'April 23 2019'
'April 23 2020'
'April 24 2020'
'April 26 2020'$'\r'
'April 27 2019'
'April 4 2020'
'August 12 2019'
'August 18 2019(whole dir)'
'August 21 2019'
'August 31 2019(after unexpected shutdown)'
'December 17 2019(whole dir)'
'December 20 2019'
'February 25 2020(whole dir)'
'January 15 2020'
'January 31 2020(whole dir)'
'January 3 2020(whole dir)'
'January 8 2020'
'July 1 2019(whole dir)'
'July 15 2019'
'July 20 2019'
'July 31 2019'
'June 16 2019'
'June 19 2019'
'June 6 2019'
'March 19 2020'
'March 28 2020'
'May 03 2020'$'\r'
'May 18 2019(before switchover)'
'May 26 2019(after switchover)'
'May 27 2020'$'\r'
'May 31 2019'
'November 17 2019'
'September 11 2019'
'September 26 2019(whole dir)'
'September 4 2019(whole dir, switchover)'
'September 8 2019'I don't know what would cause the extra characters, but I've just been manually renaming the folders(I would like to be completely automated).


Code:echo Making directory named "$(date +"%B %d %Y")"
mkdir /home/alex/spigotBackup/"$(date +"%B %d %Y")"
echo Copying data to folder...
cp -r /home/alex/spigotMC/TwentyTwenty* /home/alex/spigotBackup/"$(date +"%B %d %Y")"
cp -r /home/alex/spigotMC/plugins /home/alex/spigotBackup/"$(date +"%B %d %Y")"
cp -r /home/alex/spigotMC/logs /home/alex/spigotBackup/"$(date +"%B %d %Y")"
echo Done!But when I list the directory I get this(the ones with the extra characters are the ones created with the batch file):
Code:'April 1 2020'
'April 13 2019'
'April 16 2020'
'April 19 2019'
'April 23 2019'
'April 23 2020'
'April 24 2020'
'April 26 2020'$'\r'
'April 27 2019'
'April 4 2020'
'August 12 2019'
'August 18 2019(whole dir)'
'August 21 2019'
'August 31 2019(after unexpected shutdown)'
'December 17 2019(whole dir)'
'December 20 2019'
'February 25 2020(whole dir)'
'January 15 2020'
'January 31 2020(whole dir)'
'January 3 2020(whole dir)'
'January 8 2020'
'July 1 2019(whole dir)'
'July 15 2019'
'July 20 2019'
'July 31 2019'
'June 16 2019'
'June 19 2019'
'June 6 2019'
'March 19 2020'
'March 28 2020'
'May 03 2020'$'\r'
'May 18 2019(before switchover)'
'May 26 2019(after switchover)'
'May 27 2020'$'\r'
'May 31 2019'
'November 17 2019'
'September 11 2019'
'September 26 2019(whole dir)'
'September 4 2019(whole dir, switchover)'
'September 8 2019'I don't know what would cause the extra characters, but I've just been manually renaming the folders(I would like to be completely automated).