Article 6J1G8 Script to rename and replace content depending on filename end

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
  1. renaming the original with an identifier of the main drive at the end then
  2. changing the parts of the playlist pointing to the old drive to point to the new drive then finally
  3. save the modified content to a name beginning the same but its end is instead an identifier of the new drive;
both file name drive identifiers (at the end) start the same way, with a '-', eg -main_drive.xspf & -backup_drive.xspf
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
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments