i use this after ripping internet radio streams to number the files as they originally played (even though streamripper can do this with -q). to number other types of files, or all files, just change the *mp3. to rename directories only you could use ... ls -lt | grep ^d | cut -d ":" -f2 | cut -d " " -f2- | while read ... Show Sample Output
just an alternative to #7818 Show Sample Output
Recursively changes every file case to lowercase
find pictures recursively in a specified folder and renames the file name to originalname_containingfoldername.jpg
You can also save EXIF information by copying it to temp.jpg:
jpegtran -optimize -outfile temp.jpg <JPEG> && jhead -te temp.jpg "$_" && mv temp.jpg "$_"
Deletes unneeded files after every step and allows to use a color other than yellow at the last position.
Rename all mp4 files with crc32 information. Show Sample Output
When a large maven release goes wrong, by deploying just some of the artifacts letting others behind, some projects got wrong SNAPSHOT versions. This command comes to help! Tip: replace sed's regex by your version numbers
for music file of mp3.zing.vn Show Sample Output
this alternative shows the differences as they occur so that they are made plain Show Sample Output
A simple way to rename a set of files to a unique, randomized file name. Show Sample Output
All files in the directory will be renamed replacing every space in the filename by "_" (underline) and converting upper case characters to lower case characters. e.g. Foo Bar.txt --> foo_bar.txt
This command takes a few changes to get to the file format, but once you have that, you're good to go. Set your environment variables and then change the text "front" and "back" to whatever you're files start and end with. You'll end up with some easily sort-able files. Show Sample Output
This only includes files with numbers.
Edit as necessary. Should match the logs and the number should be least, greatest.
In the example suppose we want to move all *.rar files in the current folder to a backupfolder
touch -t 201208211200 first ; touch -t 201208220100 last ; creates 2 files: first & last, with timestamps that the find command should look between: 201208211200 = 2012-08-21 12:00 201208220100 = 2012-08-22 01:00 then we run find command with "-newer" switch, that finds by comparing timestamp against a reference file: find /path/to/files/ -newer first ! -newer last meaning: find any files in /path/to/files that are newer than file "first" and not newer than file "last" pipe the output of this find command through xargs to a move command: | xargs -ifile mv -fv file /path/to/destination/ and finally, remove the reference files we created for this operation: rm first; rm last;
This command can rename all files in a folder changing all the dots in the filename for dashes, but respecting the final dot for the extension. Show Sample Output
Renames all files ending in "_test.rb" to "_spec.rb"
The '1' in '%01d' changes the amounts of digits in the integer, eg. 1 vs 0001.
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: