Computing.Net > Forums > Linux > rename folder with current date

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

rename folder with current date

Reply to Message Icon

Name: penegrande
Date: June 15, 2005 at 11:09:12 Pacific
OS: fedora core 4
CPU/Ram: 1.8/512
Comment:

I have a backup server that mirrors the contents of another server every night. I do this with a little script I wrote which uses the mirrordir command. Then Cron runs this script on a daily schedule.

I'd like to modify this arrangement so I can keep three weeks worth of history.

So my plan is to create three scripts which will use the same mirrordir command, but will place the backups in one of three separate folders.

My problem is that I need the script to rename the folder with the current date. Does anyone know the command for this?



Sponsored Link
Ads by Google

Response Number 1
Name: tommycoolman
Date: June 15, 2005 at 17:38:18 Pacific
Reply:

Use 'mv' with the 'date' command.

For example, a folder called "tommy" could be renamed with the current date by typing

mv tommy tommy-`date +%m.%d.%Y`

This would result in a folder called
tommy-06.15.2005. Note that the characters around the 'date' command are accent marks.


0

Response Number 2
Name: penegrande
Date: June 16, 2005 at 05:25:38 Pacific
Reply:

Thank you so much Tommy.
The command I was using (that didn't work) was the one you spelled out, but rather than using accent marks I used an apostrophe.

AAAGGGHHH!!!

Thanks for saving me from my own stupid self.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Is This bad software??? Radeon X850XT PE on linux



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: rename folder with current date

Cron jobs problem www.computing.net/answers/linux/cron-jobs-problem/21299.html

Bash: rename files with 2 spaces www.computing.net/answers/linux/bash-rename-files-with-2-spaces/28152.html

Need Help with Basic Bash Script www.computing.net/answers/linux/need-help-with-basic-bash-script/18382.html