Problems with bulk renaming command

Reasons for not using gui

  • you cant script it… no record of what you did
  • you may wish to do it in a shellscript
  • you may prefer typing to mouse clik
  • your gui may not have Krename… that is kde
  • your gui may have limited capability… commands are usually more flexible
  • you may actually enjoy some mental gymnastics
4 Likes

All the things he said :smiley:

That MMV looks interesting - kinda wish I’d known about it maybe 10-15 years ago… but Perl CPAN rename / prename does everything I need… I don’t need to learn a new syntax, as it works with sed style regex - which is obtuse and obfuscating, and I’ve barely scratched the surface of it in 30 years… I can easily do recursive by using find and exec…

3 Likes

Hi @artytux,

A well written open source gui for doing rsync is FreeFileSync. I use it all the time to backup (sync) my personal files to an external disk.

3 Likes

@easyt50

Had not known about FreeFileSync always good to have option of other gui for rsync
just in case Backintime stops being maintained or just stops working properly.
Mentioned previously Backintime does have one major bug (concerns links in and to folders)

appreciate the info
Thank You

1 Like

Just happened to spot this again… for rsync’ing, I highly recommend lsyncd. Simple reason: it provides completely-automated, immediate-update coupling between a local and remote filesystem tree. (Similar to how a Dropbox folder syncs when their daemon running, except lsyncd isn’t really intended for incoming sync, only outgoing.) It will auto-sync all local file changes (or just creations but not deletions, if you configure it that way), you just write a config file and start it running. I have it configured to start shortly after login, for the local directory tree I keep synced to my file server. I save or delete anything locally in that tree, and within a second or two the changes are already replicated to the other machine.

The config format is (here again) somewhat byzantine, but that’s mostly just because of how flexible/powerful it is. For the most part, you can just ignore all the features you’ll never need.

(I will save anyone who decides to try it out some frustration and hair-pulling, though, with this tip: If you’re going to have it monitor a large directory tree, you’ll probably need to increase your system’s inotify limit because it will need a ton of them. I eventually figured out that was the culprit behind some issues I hit early on, which were easily solved by creating an /etc/sysctl.d/lsyncd.conf file containing:

# lsyncd requires a lot of inotify watches for large trees
fs.inotify.max_user_watches = 131070

(The initial value is the very arbitrary-seeming 14790, so I’ve increased it by nearly a factor of 10. That’s because lsyncd will need one watch per directory monitored ­— not per file, thankfully — and the tree I’m syncing is… well…)

$ find -type d -print|wc -l
20235
$ find -type f -print|wc -l
713207
1 Like

…Really? Are you saying you know people who’d be impressed by this stuff? Because, I’ve never met any.

3 Likes

Hit an issue this morning - where I had two folders, a disc 1 and a disc 2 for an album…

I just want them all in the same folder - but I don’t want track "01. - " from Disc 1, sorted with "01. - " from Disc 2.

So the last track on Disc 1 is number "20 - " so I just needed to add 20 to the track number prefix on each file from “Disc 2”…

You’d a thunk it would be easy - but I couldn’t find (or figure out) a suitable regex - so I just used a for loop :

for SH in $(ls *flac) ; do echo $SH ; PFX=$(echo $SH |awk -F . '{print $1}') ; NPFX=$(($PFX+20)); NEWF=$(echo $SH |sed "s/$PFX/$NPFX/"); echo "$NEWF" ; mv "$SH" "$NEWF" ; done

And to make that more readable it’s :

for SH in $(ls *flac)
do 
  echo $SH
  PFX=$(echo $SH |awk -F . '{print $1}') 
  NPFX=$(($PFX+20))
  NEWF=$(echo $SH |sed "s/$PFX/$NPFX/")
  echo "$NEWF"
  mv "$SH" "$NEWF"
done

(those “echo $” are just there for my benefit… So I can see what it’s doing…

4 Likes

So is your player happy with a 40 track disc?

I only use “file based” music players… so “sort order” is based on filename - simple… That’s all I care about… Sayonara on Linux and “Music Player Folders” on android are both “file based” (mostly).

Sayonara has one of the best metatag / id3 editors I’ve ever used - so I used it to tag the files as the correct track numbers - just in case I wanted to play the same folder of files somewhere else - that did something dumb like sort the files based on metatag…

Here’s what shits me about music player apps - why try and use some other database other than the filesystem? It’s already a damn near perfect database - why sit something else on top of it (I’m pointing at you iTunes!).
I’ve yet to check out how it works on my favourite MacOS music player - Calibri… (still nowhere near as featured as Sayonara)…

Note: I barely use either of my MacBooks for music - mainly 'cause I don’t have access to Sayonara - but also - my expensive (it seemed cheap at the time) MacBook Pro M1 has a mostly dead touchbar instead of a row of F1-F12 keys - so I have no control of volume or track number unless I use a touchbar emulator! I could have saved $400 back in 2021 by getting a MacBook Air M1… FFS!

1 Like

Agree 100%.
One thing to learn, one thing to maintain, it is readable by anything, and it works near perfectly.

There was once a phase where every app included its own builtin editor. Sanity has now prevailed and most apps let you set an editor of choice.

Hmmm, I wonder if there is such an app for movie collections that would use the file system? Here I am getting ready to catalogue them all in a database, when maybe I could sort the file system to get what I need.

I was using Cider for music player but after the crap with Apple not letting me download anything I uploaded in LINUX, I went back to Strawberry. Have never really thought about it, but that would save a lot of data entry in ripping CDs & DVDs if such an option existed.

Guess I’ll do some research.

Thanks,
Sheila

1 Like

There’s Plex and Kodi - both read media files (video and music) into some sort of database and present something like you might see on a streaming service.

Me? I have no need for such - I store every movie I have by Year and Title - but I also create subfolder e.g. “ScienceFiction” or “COEN-Brothers” - and have symlinks in those folders to the actual movie folder… e.g. :

╭─x@titan ~/Videos/Movies/COEN-Brothers  
╰─➤  pwd
/home/x/Videos/Movies/COEN-Brothers
╭─x@titan ~/Videos/Movies/COEN-Brothers  
╰─➤  ls -al
total 415
drwxr-xr-x    2 x family   16 Jun 14 12:15 .
drwxrwxr-x 1803 x family 1805 Jul 12 07:32 ..
lrwxr-xr-x    1 x family   19 Jun 16  2021 1984-BloodSimple -> ../1984-BloodSimple
lrwxr-xr-x    1 x family   22 Sep 12  2021 1987-RaisingArizona -> ../1987-RaisingArizona
lrwxr-xr-x    1 x family   23 Jun 14  2021 1990-MillersCrossing -> ../1990-MillersCrossing
lrwxr-xr-x    1 x family   18 Jun 18  2021 1991-BartonFink -> ../1991-BartonFink
lrwxr-xr-x    1 x family   25 Sep 13  2021 1994-TheHudsuckerProxy -> ../1994-TheHudsuckerProxy
lrwxr-xr-x    1 x family   19 Jun 14  2021 1998-BigLebowski -> ../1998-BigLebowski
lrwxr-xr-x    1 x family   28 Jun 15  2021 2000-OBrotherWhereArtThou -> ../2000-OBrotherWhereArtThou
lrwxr-xr-x    1 x family   26 Jun 14  2021 2003-IntolerableCruelty -> ../2003-IntolerableCruelty
lrwxr-xr-x    1 x family   19 Jun  6 11:05 2004-LadyKillers -> ../2004-LadyKillers
lrwxr-xr-x    1 x family   26 Jun 14  2021 2007-NoCountryForOldMen -> ../2007-NoCountryForOldMen
lrwxr-xr-x    1 x family   19 Jun  6 11:05 2009-ASeriousMan -> ../2009-ASeriousMan
lrwxr-xr-x    1 x family   16 Jun 14  2021 2010-TrueGrit -> ../2010-TrueGrit
lrwxr-xr-x    1 x family   25 Jun 14  2021 2013-InsideLlewynDavis -> ../2013-InsideLlewynDavis
lrwxr-xr-x    1 x family   32 Jun 14  2021 2018-TheBalladOfBusterScruggs -> ../2018-TheBalladOfBusterScruggs

The filesystem, that my Linux (Pop!_OS) desktop “titan” sees is NFS - it’s an NFS mount from my NAS, the NAS itself stores them in a ZFS dataset (i.e. local filesystem on the NAS). ZFS is posix compliant - i.e. it supports UNIX style permissions - I think inherited from UFS.

╭─x@titan ~/Videos/Movies/COEN-Brothers  
╰─➤  df -h .
Filesystem                     Size  Used Avail Use% Mounted on
baphomet.local:/mnt/BARGEARSE  9.9T  8.8T  1.2T  89% /mnt/BARGEARSE

I actually installed a Plex plugin on the NAS to index (and present) all that content - so my daughters can access it from AppleTV and their iPads and MacBooks… But I may disable it - as I don’t think they’re using it… I think you can even run Plex as a VM or a docker container - but I wouldn’t know about that. I’m happy to use SHELL commands to manage my collection (housekeep et cetera) and my GUI filemanager (Nautilus) to watch the content (double click and open in MPV - my fabourite media player) - I’ve been considering switching to Nemo - as it lets me rename files by slow double click…

1 Like