I need to convert a batch script from win 2003 to a shell script for solaris.
We have some directories on ther server where files get placed from an external source. These get placed according to the souce in different dirs
so for instance
What i want o know to how to write a script that will move the files placed in those directories, to another location say
Moving is fine but we need to rename the files as follows:
Say the file came in as
Needs to be renamed as follows
Obviously where dir1 is the source directory it came from. We had this working on windows but because of migration need to update.
Also needs to be dynamic as possible, as directories can be removed and added.
A backup of the file in a sperate directory would be nice as well.
What i was thinking was to ls the /extsource dir and output a file and then use that file in a for loop to poll each dir for files and then rename and move, but dont know all the syntax as yet.
Thanks for any input