I'm using a Korn script to rename some files using a simple function. Basically I have large set of files with the following format:
str####.asc.????? (example: str0002.asc.23154)
#### = a location number
????? = the PID of the process that created this file
...I want to rename these files to the following format:
upload.#### (example: upload.0002)
...and just loose the PID all together. I'm using the following syntax, but I still can't get it to only "grab" the location number:
while :
do
for fileName in /datafiles/str[0-9][0-9][0-9][0-9].asc.?????
do
fileExtension=${fileName#*.}
is_file_arrived "$fileName" && processFile $fileName $fileExtension
done
done
...can someone tell me the proper syntax for:
"fileExtension=${fileName#*.}"
...also how would I put in a check to see if the file that it was being renamed too, already exists?
str####.asc.????? (example: str0002.asc.23154)
#### = a location number
????? = the PID of the process that created this file
...I want to rename these files to the following format:
upload.#### (example: upload.0002)
...and just loose the PID all together. I'm using the following syntax, but I still can't get it to only "grab" the location number:
while :
do
for fileName in /datafiles/str[0-9][0-9][0-9][0-9].asc.?????
do
fileExtension=${fileName#*.}
is_file_arrived "$fileName" && processFile $fileName $fileExtension
done
done
...can someone tell me the proper syntax for:
"fileExtension=${fileName#*.}"
...also how would I put in a check to see if the file that it was being renamed too, already exists?