Script to rename and replace content depending on filename end
by DynV from LinuxQuestions.org on (#6J1G8)
I make VLC playlists (.xspf) on my main drive in the same directory as the media contained in those lists. After a while I move everything to a backup drive. Sometimes I make a variation of those playlists pointing to the new drive by
I'd like for the process to be automated, something like: For playlists ending with neither drive identifier, check if one of its location tag content start with the path for the main drive (<location>/path/main/drive/), and if so start by renaming it to identify its for the old drive, then replace the location tag to point to the new drive (<location>/path/backup/drive/), then save the modified content with a name ending with an identifier of the backup drive.
Thank you
- renaming the original with an identifier of the main drive at the end then
- changing the parts of the playlist pointing to the old drive to point to the new drive then finally
- save the modified content to a name beginning the same but its end is instead an identifier of the new drive;
I'd like for the process to be automated, something like: For playlists ending with neither drive identifier, check if one of its location tag content start with the path for the main drive (<location>/path/main/drive/), and if so start by renaming it to identify its for the old drive, then replace the location tag to point to the new drive (<location>/path/backup/drive/), then save the modified content with a name ending with an identifier of the backup drive.
Thank you