|
#1
| |||
| |||
| Ok so renaming a directory is easy in unix. But here is the difficult task: Im using the tcsh shell to write a basic script that moves certain logs to a folder at a certain time. This folder's name needs to be the current date. Moving the files is simple, but automatically generating a directory with the current date has proven difficult. Can anyone help me? |
|
#2
| ||||
| ||||
| Try using the date command, like this: $ mkdir test-`date +%F`-dir $ dir -ld test* drwxrwxr-x 2 tom tom 4096 Mar 3 14:26 test-2006-03-03-dir $ Read the man page on the various formatting options and specify them after the "+" sign as appropriate. Be sure to keep the single quote marks (`), as I have in my example above, as they instruct the shell to run the command enclosed in them and substitute the output in place where the command appears. Good luck! Peace... |
|
#3
| |||
| |||
| tomdkat you are the man...lol Thanks for taking the time to help me with this. I will format it to my needs but I got the just of it. I'm glad to see that i can count on this forum and its members. Thanks again! |
|
#4
| ||||
| ||||
| Naw, I'm not "the man"... just trying to help out. ![]() I've used the date command to do things like naming files based on a date/time stamp and it can work out very well when used right. Good luck and let us know how it works out for you. ![]() Peace... |
|
#5
| |||
| |||
| Quote:
Ok, it is about csh, but to my knowledge tcsh is mainly enhanced commandline stuff (edition etc.). So: use bash or sh instead. |
|
#6
| ||||
| ||||
| Quote:
In this case and for what he's wanting to do, (t)csh will work just fine. ![]() Peace... |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| files renaming | insomnia | Mac OS X System & Mac Software | 2 | February 27th, 2006 03:49 PM |
| batch renaming files | 27 houdini's | Mac OS X System & Mac Software | 4 | September 20th, 2004 03:24 AM |
| Renaming hd | Borrmaskin | Mac OS X System & Mac Software | 1 | January 13th, 2003 06:28 AM |
| Annyoing renaming, also in Jaguar? | Kris | Mac OS X System & Mac Software | 6 | June 2nd, 2002 06:05 PM |