I have parent folder and inside this folder I have 4 files
ParentFolder
File1.txt
File2.txt
File3.txt
File4.txt
I wanted to create subfolders inside the parent folder and carry the name of the files then move every file inside the folder that carry it is name like:
ParentFolder
File1
File1.txt
File2
File2.txt
File3
File3.txt
File4
File4.txt
How can I do that in batch or tsch script? I tried this script:
#!/bin/bash
in=path_to_my_parentFolder
for i in $(cat ${in}/all.txt); do
cd ${in}/${i}
ls > files.txt
for ii in $(cat files.txt); do
mkdir ${ii}
mv ${ii} ${in}/${i}/${ii}
done
done