My question is a bit different than:
Create directory using filenames and move the files to its repective folder
Since in the same folder I have two similar copy of each file like:
001.txt and 001(1).txt
.....
100.txt and 100(1).txt
For each two similar copies, create one folder and move both similar copies into one folder. 001.txt and 001(1).txt into 001 folder
Base on above question, but does't work. command from above question:
set -o errexit -o nounset
cd ~/myfolder
for file in *.txt
do
dir="${file%.txt}"
mkdir -- "$dir"
mv -- "$file" "$dir"
done
Have tried:
set -o errexit -o nounset
cd ~/myfolder
for file in *(1).txt
do
dir="${file%.txt}"
mkdir -- "$dir"
mv -- "$file" "$dir"
done
This command will create folder for each file.
Any suggestion to distinguish files like 001.txt and 001(1).txt, so we can select the desired file to create one folder, then run another command to archive the same goal?