Code: Select all
#qoutefile
set qoutefile "/home/ribbon/quote/qoute.txt"
#binds
bind time - "00 00 01 * *" qoute_ren
quote.jan, qoute.feb, ...
Code: Select all
#qoutefile
set qoutefile "/home/ribbon/quote/qoute.txt"
#binds
bind time - "00 00 01 * *" qoute_ren
Code: Select all
#setting the filename ur about to change
set filename "yourfile"
#bind time <flags> <mask> <proc>
bind time - "00 00 00 ?? *" file_rename
#proc-name <minute> <hour> <day> <month> <year>
proc file_rename {min hour day month year} {
global filename
file rename $filename $filename.[clock format [clock seconds] -format {%B}]; #tolower %B if u want short month name
}
by using the rename command more than once?TammeN wrote:Nice Script, but how to rename more than one file at the same time ?
Tnx
some Tcl docs guy wrote: file rename ?-force? ?- -? source target
file rename ?-force? ?- -? source ?source ...? targetDir
The first form takes the file or directory specified by pathname source and renames it to target, moving the file if the pathname target specifies a name in a different directory. If target is an existing directory, then the second form is used. The second form moves each source file or directory into the directory targetDir. Existing files will not be overwritten unless the -force option is specified. When operating inside a single filesystem, Tcl will rename symbolic links rather than the things that they point to. Trying to overwrite a non-empty directory, overwrite a directory with a file, or a file with a directory will all result in errors. Arguments are processed in the order specified, halting at the first error, if any. A - - marks the end of switches; the argument following the - - will be treated as a source even if it starts with a -.
Code: Select all
#setting the filename ur about to change
set filename "yourfile,file2,file3"
#bind time <flags> <mask> <proc>
bind time - "00 00 00 ?? *" file_rename
#proc-name <minute> <hour> <day> <month> <year>
proc file_rename {min hour day month year} {
global filename
foreach {x} [split $filename \x2C] {
file rename $x $x.[clock format [clock seconds] -format {%B}]; #tolower %B if u want short month name
}
}
Code: Select all
#setting the path
set path "/path/to/private/dir"
#bind time <flags> <mask> <proc>
bind time - "00 00 00 ?? *" file_rename
#proc-name <minute> <hour> <day> <month> <year>
proc file_rename {min hour day month year} {
global path
foreach {x} [glob -nocomplain -types f -directory $path *] {
file rename $x $x.[clock format [clock seconds] -format {%B}]; #tolower %B if u want short month name
}
}