Sample Header Ad - 728x90

How to move all mkv files from the root of media folder to own subfolder for each mkv file

-2 votes
1 answer
255 views
How to move all mkv files from the root of the media folder to own subfolder for each mkv file, with the same name as mkv filename beside .mkv extension on the end. Example home/incoming/media/ is the media folder where mkv files reside in the root, files naming examples Ibica.festival.2020.mkv in the root should get folder home/incoming/media/Ibica.festival/Ibica.festival.2020.mkv I've got around 300 files, some files where with the Chinese names and some where with Russian Cyrillic if that changes situation, at all. File attribute and dates should be detained in the new folder. I tried and I had some errors and some success with the command find . -name ".mkv" -exec sh -c 'mkdir "${1%.}" ; mv "$1" "${1%.*}" ' _ {} \; – Lots of files where moved some where not, but how would I include subtitles and info files which carry the same name as mkv file like Ibica.festival.2020.mkv srt file would be Ibica.festival.2020.en.srt and the info file would be Ibica.festival.2020.en.info ///media/ /Ibica.festival.2020.mkv /Ibica.festival.2020.hr.srt /Ibica.festival.2020.sr.srt /Ibica.festival.2020.br.srt /Ibica.festival.2020.info ///media/ /exit festival 2019.mkv /exit festival 2019.hr.srt /exit festival 2019.sr.srt /exit festival 2019.en.srt /exit festival 2019.info Should be moved to ///media/ /Ibica.festival.2020/ /Ibica.festival.2020.mkv /Ibica.festival.2020.hr.srt /Ibica.festival.2020.sr.srt /Ibica.festival.2020.br.srt /Ibica.festival.2020.info ///media/ /exit festival 2019/ /exit festival 2019.mkv /exit festival 2019.hr.srt /exit festival 2019.sr.srt /exit festival 2019.en.srt /exit festival 2019.info
Asked by Loop1 (21 rep)
Oct 16, 2023, 01:56 PM
Last activity: Oct 19, 2023, 05:48 AM