Ubuntu :: Recursively Rename File Extensions?
Feb 15, 2011
I want to rename some image file extensions from upper case to lower case but renaming all the images in all directories and subdirectories. the following code works if I am inside the folder but how do I make it work recursively?
Code:
for f in *.JPG; do mv $f `basename $f .JPG`.jpg; done;
View 2 Replies
ADVERTISEMENT
Jun 24, 2010
Linux cares about case sensitivity. This is a problem when some picture upload services accept .jpg while my camera uploaded the thousands of pictures I have as .JPG.
I can handle this task fine PER DIRECTORY. The problem is, I still have a ton of directories. Is there a way I can select - Pictures - Mass rename EVERYTHING inside and everything inside all sub directories from JPG to jpg?
Basically I want to take the existing command:
rename 's/.JPG$/.jpg/' *.JPG
a step further.
View 1 Replies
View Related
Feb 8, 2010
I am hoping someone already has a script or knows of an app that will let me do this fairly easily - I have a fairly large folder structure that goes several levels deep, etc. In many cases there are duplicate file names that are not really different, e.g.,
/home/chris/folder/folder1/doc1.doc
/home/chris/folder/folder2/folder3/doc1.doc
I want to recursively go through /home/chris/folder and move everything to /home/chris/another_location/ without subfolders and renaming duplicates as appropriate, e.g.,
/home/chris/another_location/doc1.doc
/home/chris/another_location/doc1_1.doc
View 1 Replies
View Related
Sep 11, 2009
I have thousands of files in hundreds of sub-directories that need renaming. The files I need to rename all look as below:
Note the .ogg.mp3.
been_all_around_this_world.ogg.mp3
I want to remove the .ogg from the files, so in this one case it would end up renamed looking like this:
been_all_around_this_world.mp3
View 2 Replies
View Related
May 8, 2011
I'm planning to writing a script to rename files recursively.
To be said that I'm using /bin/sh (not /bin/bash) as this is the only shell available on the busybox of the linux router (tomato) I'm using.
Basically I would like to rename files with extension .jpg using as a suffix the filename of another file in the very same directory with extension .avi
The reason for this is because pretty much all the DLNA devices like modern TV playing .avi files will display a thumbnail of the video when browsing the filesystem, however to do so they'll need .jpg image wit hthe same filename of the video in the very same directory.
View 3 Replies
View Related
Sep 9, 2009
I need a either a script or perl script that will allow me to mass rename files, folders, and sub folders. I need to replace special chars in the current file names with underscores. I was able to make this happen in a single directory, but not recursively.
Here is what does it in a single directory.
for file in *
do
mv "$file" $(echo "$file" | sed 's/[^A-Za-z0-9_.]/_/g')
done
View 8 Replies
View Related
Nov 29, 2009
My problem is this:I have a number of directories, all containing files of different name lenghts, including letters, numbers and possibly spaces. I want to recursively rename all of these files, so that only the _last_ 5 digits (not counting the extension) remain. In other words: I want to cut off all but the last 5 digits and not touch the extension.
I've tried to read up on tr, rename (perl version), sed, cut etc. and browsed through some threads here, but so far couldn't quite figure out how to do it.
If someone could point me to the right (standard) CLI tools and syntax.
View 2 Replies
View Related
Oct 21, 2010
I am trying to write a bash script that will extract a .cbr (.rar) file, traverse the extracted files in alphabetical order and rename them 001.JPG, 002.JPG, 003.JPG, etc.So far I only have this much to extract it:
Code:
#!/bin/bash
#
[code]....
View 8 Replies
View Related
Jan 29, 2011
I have a bunch of files on a Ubuntu box, which have various characters in their filenames that Windows doesn't accept (mostly ":" and "*", but possibly others).What's the simplest way to get these all renamed and moved to a Windows machine? It's OK to replace these characters with something like "[colon]" and "[asterisk]".
View 1 Replies
View Related
Aug 23, 2010
I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.
I tried the coding posted above.
find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....
but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"
View 9 Replies
View Related
Dec 28, 2010
I have a directory of a load of files without extensions. I know what the filetype should be, so is there any way of batch renaming the files to append a given extension onto it. i.e. text would be renamed as text.txt?
View 3 Replies
View Related
Aug 7, 2010
I'm using Ubuntu 10.04.1 LTS (Netbook).I need to associate ram file extension to realplayer. First time I opened a ram file I choosed the default player, Reproductor de peliculas (I think Movie player in english).Now when I choose Open with Realplayer and remember the application for this extension it opens the archive but it does not remember for the next times. It seems to be a little bug. How can I do it manually? Where is the association config file for file extensions?
View 2 Replies
View Related
Jun 14, 2011
I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.
I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also need to keep the order intact after copying.
For e.g - If I get a JPG file under /home/usr/new/1/ then the destination also needs to be /test/old/new/1/.
At the moment, I am simply putting all files under /test/old/ and I can't somehow get the later /new/1/ folder path created under /test/old/
I understand this could well be done using while OR if else loop, though if someone can just guide me with a hint, I would be really grateful.
I will complete the rest of the steps and was asking here since I am still not comfortable with the shell/bash scripts yet and planning to be really good at it over the next couple of months.
View 1 Replies
View Related
Jun 2, 2010
I have about a hundred and fifty html files that I would like to change image file extension on from gif to png. I want to change this line:
<img src="images/robopix/web/ROBOTNAME.gif" border="0">
to this:
<img src="images/robopix/web/ROBOTNAME.png" border="0">
Trouble is that ROBOTNAME is different in each of the hundred and fifty files. To make it harder, there are other gif filenames on these pages that I do not want to change. I only want the extensions to change if the address prefix is 'images/robopix/web/'. Is there any way to do this with a quick program/sed command rather than manually editing a hundred and fifty files?
View 8 Replies
View Related
Apr 20, 2010
i was just wondering if anybody knows of a command that i can run in the terminal to HIDE file extensions.I would apretiate this command and i dont mind if it is for ubuntu or windows.
View 2 Replies
View Related
Feb 13, 2011
I'm using Ubuntu for about a half year. Currently version 10.10. The next problem I have with Nautilus: He have it in ListView. If I want to rename a file then the entire file is selected and not only the first part. So the file extension is also selected. I think this is a bug, whoich can be found on the Internet, but I do not find a solution. Does anyone here have a solution?
View 4 Replies
View Related
Jan 1, 2010
Does anyone know of a way to perform a search for multiple file extensions at once in Gnome? I know that M$ Windows Explorer had this capability, but I'm just not sure how to do it in Gnome, or if it's possible. I just want to be able to perform searches for Video, Music, and Document file types, without having to perform a separate search for each file extension. Example: When doing a search for Video file types (.avi,.mp4,.mov,.wma, etc.), I would like to do one search for all files that have these file extensions, instead of doing one search for .avi files, a second search for .mp4 files, another for .mov files, etc.
View 8 Replies
View Related
Jul 15, 2010
Basically, I have a selection of .rdp shortcuts to various machines, but they are considered the file type "plain text document (text/plain)" so if I change it to open with to tsclient, all of that file type opens with tsclient. And if I change it to gedit, all the rdp files open with gedit. Is there a way to create a custom file type dependent on the extension rdp, or is there a way to set tsclient to open by extension rather than filetype?
View 2 Replies
View Related
Mar 2, 2011
I am doing a migration and where i face problem with few file formats . I have the list of acceptable file formats , now i need to find the rest of the file formats other than the acceptable file formats. is there any tool available for this ? or can some give me the VBA macro .. My VBA macro works to find the file extension in a particular folder but the problem is its ending when the count increases to 65000 (excel limit). How do i use If condition here to avoid the acceptable format and give me unique file formats .
[Code]....
View 1 Replies
View Related
Apr 25, 2011
Just recently installed the latest Ubuntu on my laptop and working perfectly. I have installed and configured LAMP but unable to figure out how to hide php and html file extensions when visiting a URL. I have enabled mod_rewrite via sudo a2enmod rewrite. Can this be accomplished globally rather than using a htaccess file?
View 6 Replies
View Related
Feb 11, 2010
GNU/Linux kernel 2.6, Slackware. VIM - Vi IMproved 7.1 Huge version without GUI. When I quit an editing sesion vim creates a backup file with the same name as that of the edited file but with a '~' appended. I would like the name for the backup file to be the following: same base name as that of the edited file and edited file extension replaced by 'bak'. Example:
Input file//////////////backup file after editing
----------//////////////-------------------------
foo.txt/////////////////foo.txt~
foo.txt/////////////////foo.bak
The first line corresponds to what vim now does. The second one is what I want vim to do.
View 12 Replies
View Related
Apr 24, 2011
I would like to use the command line to compare two directories against each other. I have two folders called music collection that have evolved over the last year on two separate computers. 90% of the two folders are the same, but there are small differences. I would like a solution that will print out all the differences so I can analyze them and choose what I want to do with them, before merging the two folders. for example.I would like some kind of output that shows the differences and where its located.
comparing MusicCollection1 and MusicCollection2
dif1.mp3 located in MC1/folder1 (this one I might want to keep and merge over)
dif2.mp3 located in MC2/folder3 (while this one I might realize does not exist in both folders because I deleted it for a reason)
I've looked at sort, uniq, and even tried scripting my own solution, but haven't come up with an elegant solution thus far. Its important that it is recursive because there are about 15 folders in Music collection and more folders under those 15.
View 3 Replies
View Related
May 11, 2010
I used a script that renamed my file eg 'echo webutil.olb | tr [A-Z] [a-z]' i wanted to rename it back to webutil.olb. How do i do this for many other files that i have
View 3 Replies
View Related
Dec 17, 2015
How to properly set some entries in:
$HOME/.config/mimeapps.list
so that:
*.odb files are opened by default with libreoffice base
*.org files (just org files not plain text files) are opened by default with emacs
For some reason I can not figure out how to proceed.
As far as I know - i.e. for what I have been reading in the documentation - the default application for a given MIME-type is specified by writing into the group [Default Applications] in the mimeapps.list file
My configuration is the following:
- 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux
- gnome desktop
View 3 Replies
View Related
Aug 5, 2011
I want to set all directories in /example/ to +x without setting any non-directory files to +x, using the -R option of chmod. There must be a way to do this yes?
View 6 Replies
View Related
Oct 18, 2010
I have a Linux machine that shares some files through NFS. The shared directory is:
/foo
I then mounted a shared directory (from a Windows machine) to:
/foo/bar
/foo/bar is mounted successfully onto the Linux machine and everything is there. However any other machine that mounts /foo from the Linux machine everything is correctly there except /foo/bar is empty. Is there anyway to do a "recursive mount" of file shares. Here is the /etc/fstab entry for the Windows share mount of /foo/bar //windows_machine/share /foo/bar cifs username=user,password=pass 0 0 And the /etc/fstab entry on the client machines that mount /foo server:/foo /foo nfs rw 0 0
View 1 Replies
View Related
Apr 27, 2010
I recently installed ubuntu 9.10. I have been trying to launch utilities and other programs that have .exe extensions by double clicking the .exe file. Each time I attempt this I get the following error message in archive manager:
[Code]...
View 5 Replies
View Related
Aug 8, 2010
I was trying to install periscope, from the instructions here: http://code.google.com/p/periscope/wiki/NautilusSupport
The problem is that at:
cd ~/.nautilus/python-extensions
I get an error:
bash: cd: /home/mycomp/.nautilus/python-extensions: No such file or directory
View 6 Replies
View Related
May 18, 2010
Suppose I have a variable called filename which contains the name of a file but the name does not contain an extension.
View 4 Replies
View Related
Aug 31, 2011
I'm using bash under Ubuntu.Currently this works well for the current directory:catdoc *.doc | grep "specificword" But I have lots of subdirectories with .doc files.How can I search for, let's say, "specificword" recursively?
View 2 Replies
View Related