The command renames all files in a certain directory. Renaming them to their date of creation using EXIF. If you're working with JPG that contains EXIF data (ie. from digital camera), then you can use following to get the creation date instead of stat. * Since not every file has exif data, we want to check that dst is valid before doing the rest of commands. * The output from exif has a space, which is a PITA for filenames. Use sed to replace with '-'. * Note that I use 'echo' before the mv to test out my scripts. When you're confident that it's doing the right thing, then you can remove the 'echo'... you don't want to end up like the guy that got all the files blown away. Credits: http://stackoverflow.com/questions/4710753/rename-files-according-to-date-created Show Sample Output
Adding course name prefix to lecture pdfs Show Sample Output
Removing Course name prefix added Show Sample Output
Sony's Xperia camera app creates files without time-stamped names. Thus, after deleting files on the phone, the same names will be reused. When uploading the photos to a cloud storage, this means that files will be overwritten. Running this command after every sync of uploaded photos with the computer prevents this. Show Sample Output
Anyone know how to avoid title casing some words, like 'to', 'of', 'that', etc.?
just an alternative to #7818 Show Sample Output
Handles spaces in file names and directories. Optionally change directories as well by pipe to tr from dirname.
Renames all files ending in "_test.rb" to "_spec.rb"
The 'rename' command with the first argument as "'s/\.//'" and the second argument as "" will remove the specified extension from the filenames.
Given a bunch of files with "wrong" date naming, it renames them in a "good" format. Show Sample Output
Sometimes I get FLAC files that RhythmBox can't play but VLC can. So I re-encode them using GStreamer at highest compression.
I used this (along with a modified one replacing `mkv` with `srt`) to remove the slight differences in who the provider of the video / matching subtitle was (as they are the same contents and the subs match anyway). So now VLC (and other video players) can easily guess the subtitle file. Show Sample Output
I had trouble with accent I could do a simple mv by hand but it is not efficient. I found this online http://www.unix.com/shell-programming-and-scripting/158635-remove-spanish-accent-file-name.html but I could not specify the accented letter direcly because it is not in the same encoding as my cli so I changed the char for their octal value. to add accent I use this table http://linux.about.com/library/cmd/blcmdl7_iso_8859-1.htm and add the values to the tr part. the other "duplicates" where not working for me. comment to help me better this script. :) Show Sample Output
Adding course name prefix to lecture pdfs
It tries to identify the file types in a directory and adds or replaces them with their appropriate extensions. Please, update the "file" tool before use it (last version: 5.37): https://github.com/file/file
The “predictive capture” feature of Sony's Xperia camera app hides the date stamp deeply inside the filename. This command adds another date stamp at the beginning of the filename. Show Sample Output
For those files in current folder that would be shown in `ls *ext`, for some extension ext, move/rename that file removing the .ext suffix from the file name. It uses Bash's parameter substitution, as seen in http://tldp.org/LDP/abs/html/parameter-substitution.html#PCTPATREF (for analog use in prefix, see http://tldp.org/LDP/abs/html/parameter-substitution.html#PSOREX2 )
Renames files in a directory to incremental numbers, following alphabetic order. The command does not maintain extensions.
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: