I have a set of files like this in a directory named 'test':
cij_000.POSCAR cij_001.POSCAR cij_002.POSCAR ....... cij_029.POSCAR
It has also four other files in the same 'test' directory as:
INCAR POSCAR POTCAR KPOINTS
What I want is, I want to create subdirectories within the 'test' directory according to the 'cij_xxx.POSCAR' file name (for example, as 'calc-xxx' are the subdirectory names), and then copy/link the other files (except the POSCAR file), and finally copy/link the 'cij_xxx.POSCAR' file to that subdirectory ('calc-xxx') as the name 'POSCAR'.
I tried the following bash script, somehow it is not doing anything (not creating the 'calc' directory and not linking the files thereby).
Could you please suggest me what should I correct, or any revised bash script suggestion?
Thanks in advance.
The bash script I tried (which didn't work unfortunately):
#!/bin/bash
for s in $* ; do
d=${s%%.POSCAR}
echo -n $d ": "
mkdir calc-$d
(
cd calc-$d
ln -s ../INCAR ../KPOINTS ../POTCAR .
ln -s ../$s POSCAR
)
done