General :: Rename Command Using Random Variables?
Apr 14, 2010
I'm trying to clean up some files and I've been using the rename command as its the easiest way I've found to do it. One problem I've found is that on a couple of batches of files they have a set random numbers on them which I need to remove.
Only problem is I can't find a way for rename to "lock" onto those numbers to remove them. The file name structure is something like this:
file name[random numbers].extension
There are brackets around the numbers as well which I'm not sure will help or not.
View 1 Replies
ADVERTISEMENT
Jun 30, 2011
I have a bunch of photos with varying names. I want to give each photo a random name(*), how do I do that? (*)I'm going to put them on a digital photo-frame that can't shuffle
View 4 Replies
View Related
Dec 22, 2009
What is the ssh commands to rename a group of files?
I need to rename:
avatar_01.jpg
avatar_02.jpg
[code]....
View 5 Replies
View Related
Aug 27, 2009
I am using hte rename command to clean up a bunch of files. I know you should be able to use regex with the rename command, but it seems to ignore them.Most of the time I am using something like:rename 'something' 'some' *Now lets say I have files named:
someFile(2009).ext
otherFile(2008).ext
File(2006).ext
[code]...
View 9 Replies
View Related
Aug 2, 2010
I would like to run a bunch of SQL commands from mysql client in bash. However, I would like to store the output in different variables. E.g.
Code:
var1=`mysql -u[user] -p[pass] -D[dbname] -e "Query1"`
var2=`mysql -u[user] -p[pass] -D[dbname] -e "Query2"`
[code]...
View 5 Replies
View Related
Feb 18, 2010
Suppose I have the following files:
1132_1_fr.mp3
1132_2_fr.mp3
1132_3_fr.mp3
.
.
.
1132_3_fr.mp3
[Code].....
So I want to add PD_ to those who dont have this preindex and get rid of _fr.
basically rename files in a same directory!!
View 6 Replies
View Related
Sep 17, 2010
I am having problems with symbolic links and the $PATH variable.I have a directory:# /usr/rulerX/squarewhere /usr/rulerX/square is a symbolic link such that:
# ls -la
square --> square.hg.current
My path variable is set as:
[code]....
View 2 Replies
View Related
Oct 16, 2010
What's the zypper command to rename a repository name? Not yast.
View 6 Replies
View Related
Mar 14, 2011
In a moment of madness I decided to reorganise my mp3 player. I am putting everything into one folder (called 'all'), but first I am renaming the files to the following format:
artist ## songtitle
where ## is a number like 01, 02. This has been pretty straightforward with the songs that already started with a number, because then I could just
rename 's/(dd)/artist $1/' *.mp3
but I have a problem with those tracks that don't already have the track-numbers at the beginning. I suppose what I am asking is: can I turn
All Along the Watchtower.mp3
Purple Haze.mp3
Hey Joe.mp3
into
01 All Along the Watchtower.mp3
02 Purple Haze.mp3
03 Hey Joe.mp3
View 1 Replies
View Related
Feb 15, 2011
I'm trying to put a variable into the rsync command but I just get some BS error about escaping - whatever that is suppose to mean.
This is my command:
Code:
rsync -rvvuc --exclude '/Output/*' ${OPTARGS} --delete "${SOURCE}scripts/" "${DEST}scripts/"
${OPTARGS} has this value:
--rsh='ssh -p 34'
Wont work. If I type that text directly, then it works. Other then using some if statement to have two different command calls, how can I make this work?
View 3 Replies
View Related
Apr 30, 2009
I have a bunch of mislabeled files among other things but I'll start with this first. as using the command line to fix this issue.
View 5 Replies
View Related
Feb 11, 2010
I am taking an argument from the command prompt for my shell script ie $1 and i need to use $1 in my awk part of the script.But it actually doesn't get any value when used in awk. accessing this command line argument in awk?
View 5 Replies
View Related
Jun 30, 2010
I've just noticed something odd with 'su'. When you run 'su' with both the '-' (aka -l) and -c command options like this: "su -l user -c command" it doesn't appear to run /etc/profile before running the specified command even though the -l option is specified. If you run "su -l user" without the -c it does run /etc/profile.
Now, on other linux such as fedora it works as expected and runs both /etc/profile followed by the command specified on the '-c'. I'm fairly sure it used to work this way on Slackware (and every other UNIX I've ever used) too. "su -l root -c env" is a good way to see, as you'll find most the environment variables are missing.
View 6 Replies
View Related
Aug 9, 2010
I misused wildcards like a moron, in the rename command. I repeated names twice in a 3gig folder, which I cannot afford to delete. Now, the rename command is not working, and it says the file name is too long. I am a competent programmer in Java, PHP, and I know basic C.
View 7 Replies
View Related
Jun 1, 2010
I'm trying to rename all files in a folder as such:
1.jpg
2.jpg
3.jpg
Renaming them is no problem, the problem I have is, they need to be in order of the datetime that they were taken, so that the 1.jpg would be the oldest file there. The difference in filetimes is going to be very small, around 3 or 4 tenths of a second.
The reason I need to do this is that I have another script (not quite finished yet), that takes the next three files in a loop and applies qtpfsgui to them to output an HDR image to another folder, then move on to 4,5 & 6, and: repeat.
View 9 Replies
View Related
Jan 21, 2011
I want to rename some files in one directory and found the command 'rename' most appropriate.
Changing the file extension is easy since there are lot of examples for this.
But now I want to rename my files like this:
'somePrefix_blablabla.ext' --> '0_blablabla.ext'
'somePrefix_blablablablabla.ext' --> '0_blablablablabla.ext'
I DON'T want an incrementation, just the leading prefix '0_'
correct perl expression syntax for this?
View 2 Replies
View Related
Aug 18, 2010
i am trying to write scripts to pass 2 different variables to find command.
find . -name $var1 -exec grep -H $var2
find . -name CDR_2010-07-21 -exec grep -H 9892614477 {} ;
1st variable CDR_2010-07-21(passed by var1) is the file name inside which i am trying to search string 9892614477(passed by var2). i have tried following script
[code]...
View 9 Replies
View Related
Jul 2, 2010
Anyone else using the Mill Hill & Canterbury (MHC) Modula-2 to Java compiler?
[URL]
I cannot access the command line options and the environment variables.
View 2 Replies
View Related
Apr 6, 2011
mkvmerge -o <filename without extension>_TV.mkv -S <filename> && mkvextract tracks <filename> 3:<filename without extension>.*** && perl /home/brian/Desktop/ass2srt.pl <filename without extension>.*** && rm <filename without extension>.***
Doing these commands for multiple command line file inputs is the goal. So I can just type ./script.sh *.mkv in my terminal.This is what I have so far, but it doesn't work whatsoever.
View 2 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
Jan 19, 2010
I'm looking for a script that copies a random .jpg from a random folder in my ~/Pictures folder to my ~/temp folder with a standard filename. This file will then be displayed in Conky. I can fix the last part, but I cannot find a way to do the first part.
View 3 Replies
View Related
Jan 26, 2011
Since updating my graphics driver on ubuntu 10.10, My splash screen has been inconsistant and messed up. Sometimes ill get random command lines mixed in with the usual splash, sometimes the splash wont show and it will just be black till the desktop appears, sometimes it flashes on and off. I originally tried fixing the resolution and just made the problem worse. Then I tried installing a new splash via gnome-look.org, but it just made my shut-down splash blank and didnt effect my splash at startup. I just want the original splash that ubuntu is supposed to have.
View 6 Replies
View Related
Nov 9, 2009
I accidently created an account with the wrong username. I need to change it to something else. I never done this before but I think you can issue this command "usermod -l login-name old-name" which only changes the username nothing else.I know I will also need to change the home directory to reflect the changes but I am not sure what to do.
View 4 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
Nov 21, 2009
At the time of installation UBUNTU 9.04 ,I just create 4 partition from 80GB hddi.e
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6079 48829536 83 Linux
/dev/sda2 6080 9729 29318625 5 Extended
[code]...
View 11 Replies
View Related
May 19, 2010
How would I rename a file say old.txt to new.txt in Linux using commands?
would it be...?
rename old.txt new.txt
View 2 Replies
View Related
Jun 11, 2010
How to go through all the subfolders and rename all the folders named 'Old' to 'New'
View 2 Replies
View Related
Mar 7, 2011
I just installed Linux on a second partition. The label of this partition is currently " newlabel " i want to change this to "linux" how to do this.
View 2 Replies
View Related
Jul 12, 2010
using variables in CURL.Here's my code:
transfer_to_pcid="AAAAAAAA"
transfer_from_pcid="BBBBBBBB"
basic_password=`ssh rsync@some_test_domain 'curl --silent
[code]....
View 2 Replies
View Related
May 19, 2010
I am running Linux and I have some basic console knowledge but my current problem is quite difficult and I dont know how to achieve this. I want/need to rename everything within a folder that matches a given string.
By everything I mean:
folders/files
content within a file
content in hidden files
Basically I want to refactor a Java-project. Sure, I could use Eclipse to handle the replacing, but this leaves out the folders or resources outside of my workspace. I was thinking of a script that could do the job for me but this seems rather tricky. For instance when it comes to folder-/file-rename I want to replace only the part of the name that matches my string, the rest should remain untouched.
View 2 Replies
View Related