Ubuntu :: Rename Multiple Files With Only Parts Of The Original Name In The New Name?
Jan 26, 2010
Could someone help me find a way to rename a file to a different name containing parts of its old name?
For example:
Original file name: filename1.abc.xyz.some.other.stuff
Final file name: filename1.abc.xyz
The length of the file name is not constant. the abc.xyz is not constant but that format is (three numbers.three numbers) the .some.other.stuff is not constant and its what i want to get rid of
View 8 Replies
ADVERTISEMENT
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
Sep 10, 2010
How I could rename multiple jpg files. Say I copied IMG0001.JPG until IMG0134.JPG from my camera, and want to rename IMG0001 until IMG0064.JPG to 'party01.JPG' untill 'party64.JPG', etc. In windows there was a stupid wizard to rename files when you copied them onto your HD from a camera. Is there any good way to do something similar in ubuntu?
View 1 Replies
View Related
Feb 22, 2011
I am quite new to script programming and I am facing an uphill task to rename files in one folder. I have gone through similar posts but most of them deal with renaming files by changing the file extensions.Problem : I have a folder which contains files like bild01.jpg,bild02.jpg. There are more files in the folders which should remain untouched. I want to rename these 'bild' files as follows:
bild01.jpg -----> 1c.jpg
bild02.jpg -----> 2c.jpg
bild30.jpg------>30c.jpg
I would like to create a script as:
#!/bin/bash
npics=`ls -1 bild*| wc -l`
[Code]...
View 1 Replies
View Related
May 21, 2010
I'm trying to figure out how can I fill up multiple files with easytag. It looks like one can do it by selecting all files and using one of the schemes like " %a - %b/%n - %t " but to be absolutely honest I have no clue how it works. I'd like to fill up all selected files' tags with Artist, Title, Album, Year, Track# and Genre. How can one do it ?
View 9 Replies
View Related
May 9, 2011
bash script to give sensible names to a large number of photos. I hope to be able to run a script with an argument which will become the filename followed by a number beginning at 1.
Code:
./file_rename.sh Summer2009_
Summer2009_0001
Summer2009_0002
Summer2009_0003
[Code]....
View 1 Replies
View Related
Oct 3, 2009
i have lots of files with dots insde file name for example:
document.1.is.bigger.doc
resume.version12.doc
10.photo.www.cnn.com.jpg
i want to rename all files in that directory to be the same (with same extention) but convert dots to underscore "_"
how can i do that on bash script / php.
View 6 Replies
View Related
Jul 25, 2011
How would I rename all files with a leading decimal point recursivley? I some how got all my music files to have a decimal point.I tried the below and got a " sed argument to long".[CODE]find /media/MUSIC -type f -name "*.wma" | xargs -0 sed -i 's/.(.*)/1/'[CODE]
Another question, can i just use -type f with out -name ? I am sure that all the files got the decimal point added as the first character.
View 14 Replies
View Related
Feb 11, 2010
Is there any way to split a tar archive into multiple parts?
View 1 Replies
View Related
Sep 14, 2009
I've got about twenty folders with names such as "Bennett Galleries" or "Athletic House" and I want to rename them to "Bennett_Galleries" or "Athletic_House". Any right utility to use to accomplish this (sed, awk, bash script, etc...)?
View 2 Replies
View Related
Mar 28, 2010
i have a large directory of .bsp files that i would like to convert .bz2 archives. I've been searching for some time and all i can find is the obvious compress multiple files into one large archive. If anyone knows how to convert each file individually, while retaining the original file name (testmap.bsp would be archived as testmap.bsp.bz2)
View 5 Replies
View Related
Aug 26, 2009
How do you rename:
abc123.txt
abc124.txt
abc125.txt
to
abc.txt.123
abc.txt.124
abc.txt.125
Basically, I want to move the digits from the filename to after the extension.
It works for one file if I type:
rename 123.txt .txt.123 abc.txt.123
but I have thousands of files like these.
View 1 Replies
View Related
Jan 12, 2011
I have bought an external usb hard drive on which I back up my three computers every once in a while.Space will quickly be used up.I can't find that little bit of research that I need yesterday.Here is what I would like to find:An application that eliminates doubles in identical files and renames files that have changed by appending the last saved date yyyymmdd to the file name.Does such an application already exist?
View 6 Replies
View Related
May 7, 2009
Until now i haven't had to dabble with bash scripts.
I have a program that reads in data files. These are named datafile01_R, datafile01_G, datafile01_B, they then increment, so datafile02_R etc i have about 600 of these. the program reads in 3 data sets at a time from each run, so files_01 r, g, and b.
The program then does its magic, and outputs about 40 different files, depending on the file, they gone to folders named R, G, B, psa, or tracking.
The program itself has configuration files to say where the files should gone when analyzed, there is also the config files that reads in the data sets.
At the moment i have to run one set of data, then go in and manually change the input file location, and run again. But, doing this, even though a different data set, the new set overwrites the old set in one of the output folders. So i need a way to increment the output filenames after they are written and before the program is run again with the new data set.
View 1 Replies
View Related
Apr 13, 2010
I used split -b 32m "file.bz2" "file.bz2.part-" to split a file and it created more than 50 parts. From googling, the way I found to reassemble the parts is to cat file.bz2.part-aa file.bz2.part-ab > file.bz2, while enumerating all the 50+ parts. Is there an easier way to reassemble the parts wherein I no longer need to list all those parts explicitly?
I'm using Fedora 12.
View 3 Replies
View Related
Sep 7, 2010
I am facing a problem while splitting a text file, I need to split a file into some parts and each split file should have 2000 lines, when I do it through "split" command the mother file is kept intact but as per my requirement I need to cut mother file into some parts thus it should not be kept intact.
Example:
file size
motherfile.txt 5000 lines.
after split
motherfile.txt 2000 lines.
childfile1.txt 2000 lines.
childfile2.txt 1000 lines.
View 7 Replies
View Related
May 26, 2011
Today encoders are getting smarter. They can compress Blu ray similar quality in 700MB. It seems header of video file contain info about frame rate, audio/video encoder etc. which can't be guessed. In MPEG audio , every part of file is independently playable. If a movie is binary split into 6 parts & I don't have the first part then it is unplayable.
Code:
example
ls
-rwxrwxrwx 1 root root 280M 2010-12-07 20:23 irn2-cd1.mkv
-rwxrwxrwx 1 root root 50M 2011-05-26 13:09 last-50M-cd2
-rwxrwxrwx 1 root root 50M 2011-05-26 13:44 first-50M-cd1
file *
first-50M-cd1: Matroska data
last-50M-cd2: data
irn2-cd1.mkv: Matroska data
View 1 Replies
View Related
Jul 2, 2011
dear the Admin(s) and all of the members
suppose that we wanna install a program, so we must do this : sudo apt-get install program_name after installing that file, yeah indeed we can run that program, but where can actually we find the original-downloaded file in our ubuntu?
View 2 Replies
View Related
Jul 8, 2011
Im trying to auto rename badly named mp3's using info from the id3 tag. I got a nice little program called id3ren, it works fine apart from it doesn't add the track number. Cant figure how to enable this function. The track numbers are in the ID3, but it just renames to Artist/Trackname. Any other users on here?
View 9 Replies
View Related
Jun 12, 2011
I am running a recently installed minimal install. I am having some fun building the system up but trying to keep things slim. I have installed the ATI catalyst drivers working from the tutorial here under 'Installing the Restricted Drivers Manually': [URL]... After successfully getting the ATI driver running, I realise I really don't need or want it and am wanting to uninstall it completely and return the config to the way it was. Some of that I can do with the aid of some of the links I have found but installing the ATI drivers no doubt killed some of the packages that were there in the first place (graphics was fine in the first place incidentally). Question: What might these squashed packages be so I can reinstall them and have graphics setup as it was before I installed the ATI drivers and how can I remove all trace of the ATI drivers?
View 8 Replies
View Related
Oct 14, 2010
I have this script:
Quote:
for f in d*; do mv "$f" "T${f#d}"; done
it outputs all files which strats with letter d to T but it doesn't work when i run it from Cron. It only affect root file / .
How i can make work like this:
/home/user/files/dfile.txt
=>
/home/user/files/Tfile.txt
View 2 Replies
View Related
Nov 8, 2010
I guess the title says it all. I'm looking for a program that will rename a massive amount of files at once. JPGs specifically, or PNGs. More specifically,I'm creating a stopmotion movie. Using the program StopMotion. And for that, all you pictures, or frames, have to be named 001.jpg 002.jpg and so on. I've got about 300 or so images, and they're all named the default thing that my camera names them, you know, like DSCIM8520 or whatever. I'm looking for maybe a command line program or GUI is fine too, that will do this for me.
View 3 Replies
View Related
Dec 31, 2010
I have many files in a directory. They all have names with a .pdf extension. How can I remane all of them so that they are named as so... 1.pdf, 2.pdf, 3.pdf? I want to do it with one command or somehow that I do not have to manually rename each one.
View 1 Replies
View Related
Jan 12, 2011
I need to find and rename all .JPG files to .jpg in a folder with subfolders. How would I go about this?
View 1 Replies
View Related
Jul 11, 2011
The music files as named like the following: 01 Music Title. I would like to get them as: Band Name - Music Title. I looked into the rename command and I was thinking of doing something like this:
Code:
rename "s/(the first two integers)/Band Name -/g" *.mp3
The problem is that I don't know how to indicate the first two integers. Does anyone know how to do this?
View 2 Replies
View Related
Oct 12, 2010
After 2 weeks of work to restore my server to working condition (after a failed HDD) I am facing a very strange problem. Basically, random files (config, scripts, etc) are either going mising or are reverted to original states. Example1: This morning, I went to use VNC to remote login in my server. I couldnt start the VNC server. I used ssh to login and searched for a lock file (.pid) or anything else preventing VNC from starting, only a few minutes later to open rc.local_shutdown and discover that it was only containing:
Code:
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
All my custom commands were gone...
Example2: Yesterday, I was still using my NFS shares to play music and movies. All worked perfectly. A few minutes ago, I tried to mount the NFS shares on my laptop but it did not work. I used ssh again to login in the server and discovered that nfsd was not running. I tried to start it and it said that there were no exports to share (or something like that). I opened /etc/exports and it was PLAIN empty!! However, I had a export.orig file in /etc... SO somehow, something erased my exports file but care to create a backup of it!
Question: What could do such stupid stuff? Hints: I did not install anything. I did not fool around with anything. The server was unpowered between yesterday and today.
View 3 Replies
View Related
Feb 14, 2010
Getting together a script that will add numbers to all the files in a folder.
I've ripped most of my CDs to oggs for my new pmp, but I found that the pmp doesn't like files that are numbered just as 1 and 2, as it thinks that the 2 is more than 10.
So instead of going through all of my music folders and renaming every file by hand from 1 to 01 and from 2 to 02, I'd ask if there's a script that can be executed to add these numbers for me. It'd be even better if it only added the number to the files with only one digit.
Here's an example:
I want to rename:
And I'd like to do it to all single-digit files lower than 10 in the folder, if possible. If not, I can isolate them by hand.
View 4 Replies
View Related
Jun 19, 2010
I want to rename all files in a directory to "random" names(the point is that the name does not exist, it can be anything). In my case is it *.wav file i want to rename, i basically want to burn cd's to my pc with cdparanoia, then rename them and put them in a directory with other songs i have which also have been given random names. (i'm creating a big music directory where the songs have no names)And i will eventually make a script to make things easier, but for some reason i can't think out a way to rename the files randomly, and i guess "$RANDOM" is a good variable to use but.. how?EDIT: And while i'm at it, is there any way to use the "play" command in the terminal, by "sorting" music files in a directory randomly, and then play them, so it will not be played the same order again?
View 4 Replies
View Related
Sep 11, 2010
In my photos folder, I have hundreds of folders, each with Picasa.ini files.
Unfortunately, a lot of these files are actually ".picasa.ini" files & Picasa 3.0 does not recognize them.
All I want to do is rename all those ".picasa.ini" files to "Picasa.ini".
If there was a GUI way to do this, all in one go, then that would be my prefered method.
I couldn't find one, so reluctantly tried Terminal. After a lot of reading & trying, still no success.
"locate .picasa.ini" finds all the files easily.
I tried many variants around: "rename -v -n 's/.picasa.ini$/Picasa.ini/' .picasa.ini" to run a simulation without screwing anything up yet, but at best they only seem to rename one occurence, not all the files.
View 6 Replies
View Related
Oct 20, 2010
I need help with renaming files and folders in one go.
I have a folder called /opt/utility/pictures/
Inside that folder have sub-folders and files such as code...
View 6 Replies
View Related