Other removing 4 beginning characters from a list of files

Hi I hope some one could please show me a way about removing the 4 beginning characters from a list of files.
Code:
001-Turntable.mp3
002-Darius Rucker - Wagon Wheel (Official Video).mp3
003-Foy Vance - 'She Burns' [Official Video].mp3
004-Wild as We Came Here.mp3
005-Uncle Tupelo - Moonshiner.mp3
006-Sarah Jarosz - House of Mercy - Official Video.mp3
007-Whatcha Gonna Do.mp3
008-Red Pony.mp3
009-Blue Ridge Blood (feat. Buddy Miller).mp3
 
what shell should I use. I'm using sh and no changes occurred. I tried one file name to and it didn't work. plus I was hoping to change all files with a *
 
I get this output trying a practice folder.
Code:
paul@musicdl:~/practice5 $ sed -i 's/^....//' *.txt
sed: 1: "001-test.txt": invalid command code -
ls

Code:
001-test.txt    003-test.txt    005-test        007-test        009-test        011-test
002-test.txt    004-test        006-test        008-test        010-test        012-test
 
well the -i .bak made the backups but -i '' didn't work
Code:
paul@musicdl:~/practice5 $ sed -i  's/^....//' *.txt
sed: 1: "001-test.txt": invalid command code -
Code:
001-test.txt            003-test.txt            006-test                010-test
001-test.txt.bak        003-test.txt.bak        007-test                011-test
002-test.txt            004-test                008-test                012-test
002-test.txt.bak        005-test                009-test
 
… a list of files. …

This is for a file that comprises (by coincidence) a list of files:

Code:
% pwd
/tmp
% nano filelist.txt
% echo $SHELL
/bin/tcsh
% sed -e 's/^....//' /tmp/filelist.txt
Turntable.mp3
Darius Rucker - Wagon Wheel (Official Video).mp3
Foy Vance - 'She Burns' [Official Video].mp3
Wild as We Came Here.mp3
Uncle Tupelo - Moonshiner.mp3
Sarah Jarosz - House of Mercy - Official Video.mp3
Whatcha Gonna Do.mp3
Red Pony.mp3
Blue Ridge Blood (feat. Buddy Miller).mp3
%
 
To do it graphically install 'thunar', it's the filemanager component of xfce. It has a bulk rename feature. Select multiple files, press F2 - follow your nose. It's very convenient.

Yes, I already realise you may only want to be doing this in the shell.
 
thank you it work great

If you like, add the Solved prefix :-)



… a bulk rename feature. …

👍 also found as a standalone application:

1647133192970.png

One application with two names:
  • Bulk Rename
  • Bulk Rename - Rename Multiple Files
Revealed by htop:

/usr/local/bin/thunar --bulk-rename

x11-fm/thunar
 
There's an old CLI one called vimv (unrelated to vim), it would present a vi text editor in which you would edit the presented text lines and those would become the destination file names. It was quite cool. It looks like it still exists but I'm not sure if it made it to FreeBSD.

Someone has a version here: https://github.com/thameera/vimv , see the little screenshot animation at the bottom. I first used vimv ~20 years ago off some random script of the Internet, I'm not sure where the official origin of it was (aka this github link is just a clone most likely).

There are another couple of tools like this for different editors. Do not turn this into an editor war.
 
Back
Top