SSH renaming of multiple folders and files
Posted: 02 Jan 2020, 21:15
Hi,
I have everything set up and have done some tests to ensure Filebot is working as expected via SSH from my Mac to a QNAP. However, as a noob I'm unsure of the script to get all folders and files into a consistent format. What I have is (for example):
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Alien/Alien.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Aliens/Aliens.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Alien\ \3\/Alien\ \3\.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Alien\ \Covenant\.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/After\ \Hours\.mkv
What I want is to do the following in one go:
- File names to have the movie year appended
- Folder names to have the year appended
- Files that are in the /Movies/ folder to each have a folder created with the movie name and year and for the file to be moved into it's respective folder
So:
Movies/Alien/Alien.mkv
would become
Movies/Alien (1979)/Alien (1979).mkv
Movies/Alien\ \Covenant\.mkv
would become
Movies/Alien\ \Covenant\ \(2017\)/Alien\ \Covenant\ \(2017\).mkv
What I'm struggling with is how to wildcard files so that every file is included, whether it's in the /Movies/ folder itself or already within it's own sub-folder.
Help greatly appreciated!
I have everything set up and have done some tests to ensure Filebot is working as expected via SSH from my Mac to a QNAP. However, as a noob I'm unsure of the script to get all folders and files into a consistent format. What I have is (for example):
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Alien/Alien.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Aliens/Aliens.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Alien\ \3\/Alien\ \3\.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/Alien\ \Covenant\.mkv
/share/MD0_DATA/Multimedia/Movies\ \&\ TV/Movies/After\ \Hours\.mkv
What I want is to do the following in one go:
- File names to have the movie year appended
- Folder names to have the year appended
- Files that are in the /Movies/ folder to each have a folder created with the movie name and year and for the file to be moved into it's respective folder
So:
Movies/Alien/Alien.mkv
would become
Movies/Alien (1979)/Alien (1979).mkv
Movies/Alien\ \Covenant\.mkv
would become
Movies/Alien\ \Covenant\ \(2017\)/Alien\ \Covenant\ \(2017\).mkv
What I'm struggling with is how to wildcard files so that every file is included, whether it's in the /Movies/ folder itself or already within it's own sub-folder.
Help greatly appreciated!