Hi all,

I am going slightly insane about this because I have been spending a lot of time on this simple thing and I am not sure what is wrong. I just want to rename a couple files that are time and date stamped to something that I can easily read into my python program. Anyway the original file has a format as follows:


I would want to rename them as follows:


Where p keeps changing according to the data channel. At the moment I have this:

set D=`date +%Y-%m-%d`
cd $HOME/Users/riedel/iceanalysis
set i=0
while ($i<12)
if ($i<10) then
set p=p0$i
mv $1$2_9hst-${p}_${D}*.data $1$2hst${p}.dat
set p=p$i
mv $1$2_9hst-${p}_${D}*.data $1$2hst${p}.dat
set i=$i
@ i++

What happens is that the mv command demands a folder as the destination. The sanem thing happens when i use cp, which would be fine as well.I have read the man page and have googled my fingers off and cant find a solution to the problem.

If there is some niffty way in python to do this. I would be open to that as well

I need to do this in teh tcsh shell because the computer is setup really weirdly.

Thanks a lot in advance for any input here.

That * catches both files on the same command, so it assumes you are trying to move both files to a directory. You will have to handle them one at a time (i.e. without the * ).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.