Skip to main content
4 of 4
Adding assumption
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

Assuming we know that all files have the filename suffixes .html or .txt and that all directories have the suffix .directory, you can use:

for i in *.txt *.html
 do
  mv "$i" "${i%%.*}.directory/$i"
 done 

Run this in same directory where you are having files. It will remove trailing .txt and .html from file names and then will move files to destination directory.

Prvt_Yadav
  • 6k
  • 7
  • 39
  • 52