How do I rename 2009-08-2009-08-13 to 2009-08-$my_var_till_2009-08-13 for multiple files? The 2009-08-13 portion changes with respect to the date of the file, so I need a way to grab that part of the filename. Could I use basename somehow?
feedback
|
|
If the file names are always in that date format, I think that something like this would work (in a script) - this is, of course, assuming that they are all in the same directory and '$my_var_till' is defined in the shell:
if '$my_var_till' is not defined in the shell, you could take it as a command line argument (of course you might want to add some error checking with the argument):
| |||
|
feedback
|
|
Linux: obligatory 1-liner...
expanded
you could also use the assuming your variable is a variable you have set in the shell, which is what I think you're asking. Windows: rename 2009-08* 2009-08-%my_var_till%_* | ||||
|
feedback
|
