glkshankar
New Member
First of all, I was trying to find the right forum to ask my noob question and after several searches found good reviews about this place. Now let me come to point, I have around 1000 media files in a folder and want to create a folder with a suffix of the year of release and then move the media file into that directory. Currently, all my media files are with various extensions eg: mkv,mp4,srt,wmv etc and all the file names have spaces in them as below. And also I have a text file which has the folder name with 'file name (YYYY)'. which I can create all the folders easily using "xargs -I {} mkdir -p "{}" < folders.txt".
But now the question is how to move the file into the folder?
File Names:
'Angel Has Fallen.mkv'
'Apocalypse Now.mp4'
Aquaman.mkv
Arrival.mkv
Arrival.srt
Avatar.sub
Folder name is going to be
'Angel Has Fallen (2019)
'Apocalypse Now (1979)
Aquaman (2018)
Arrival (2016)
Avatar (2009)
Tried this one but no luck
for i in *
do
file_name="${i%.*}"
folder_name=${file_name::-6}
mv $file_name $folder_name
done;
Any suggestions or help is greatly appreciated..
Cheers
But now the question is how to move the file into the folder?
File Names:
'Angel Has Fallen.mkv'
'Apocalypse Now.mp4'
Aquaman.mkv
Arrival.mkv
Arrival.srt
Avatar.sub
Folder name is going to be
'Angel Has Fallen (2019)
'Apocalypse Now (1979)
Aquaman (2018)
Arrival (2016)
Avatar (2009)
Tried this one but no luck
for i in *
do
file_name="${i%.*}"
folder_name=${file_name::-6}
mv $file_name $folder_name
done;
Any suggestions or help is greatly appreciated..
Cheers