This command will replace all the spaces in all the filenames of the current directory with underscores. There are other commands that do this here, but this one is the easiest and shortest.
The simplest way I know. Show Sample Output
Replace 'SHOWNAME' with the name of the TV show. Add -n to test the command without renaming files. Check the 'sample output'. Show Sample Output
the "i" controls case sensitiveness. It's slightly inefficient since it uselessly renames .jpg to .jpg, but that's more than compensated by launching only one process instead of two, besides being shorter to write.
Changing a file extension to a new one for all files in a directory.
Best to try first with -n flag, to preview
This uses Perl's rename utility (you may have to call it as prename on your box) and won't choke on spaces or other characters in filenames. It will also zero pad a number even in filenames like "vacation-4.jpg".
Note the g for global in the perl expression; without it, only the first occurrence in the name would be replaced. Show Sample Output
Useful when you want to quickly rename a bunch of files. Show Sample Output
This command is useful for renaming a clipart, pic gallery or your photo collection. It will only change the big caps to small ones (on the extension). Show Sample Output
It's the rename-tool from debians perl-package.
Would this command line achieve the desired function? My CLI knowledge is not great so this could certainly be wrong. It is merely a suggestion for more experienced uses to critique. Best wishes roly :-) Show Sample Output
This commands removes space from all the files with specific extension. I've specifed *.jpg as an example.
Uses 'rename' to pad zeros in front of first existing number in each filename. The "--" is not required, but it will prevent errors on filenames which start with "-". You can change the "2d" to any number you want, equaling the total numeric output: aka, 4d = ????, 8d = ????????, etc. I setup a handful of handy functions to this effect (because I couldn't figure out how to insert a var for the value) in the form of 'padnum?', such as: padnum5 () { /usr/bin/rename 's/\d+/sprintf("%05d",$&)/e' -- $@ } Which would change a file "foo-1.txt" to "foo-00001.txt"
Substitute spaces in filename with underscore, it work on the first space encountered.
rename is a really powerfull to, as its name suggests, rename files Show Sample Output
renames Anime Episodes to files, that can be parsed by sonarr & co Show Sample Output
This will change all files ending in .JPG to .jpg and will work with any file extension
Uses vi style search / replace in bash to rename files. Works with regex's too (I use the following a script to fixup / shorten file names): # Remove complete parenthetical/bracket/brace phrases rename 's/\(.*\)//g' * rename 's/\[.*\]//g' * rename 's/\{.*\}//g' * Show Sample Output
All words of the filenames except "a", "of", "that" and "to" are capitalized.
To also match words which begin with a specific string, you can use this:
rename 's/\b((?!hello\b|t)[a-z]+)/\u$1/g' *
This will capitalize all words except "hello" and words beginning with "t".
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: