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
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?
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.
Summary: Hi Don, Thank you for your answer. But, the problem is not the PATH problem. tar runs quite fine even without PATH. The problem is I want to use current date in my file name. For this I use the...
Summary: I have a couple of folders containing spam and ham on which I cron sa-learn (from spamassassin) for each of my users. This works fine and dandy, users dump emails into these directories and the databa...
Summary: I need help with this basic script writing using bash shell. I just started using Linux and the company I work for is trying to instill this system. How do I write a script that will create a menu to ...