12-10-2008
Debuggin' my rename script
hey everyone.
i was on unix writing a script to rename all my files. and i've been running into problems. i really think this script has potential but i dont know how to get it as to wheres there are no errors. heres basically the steps i used. if some can write the script using the steps i plotted out and tell me where i went wrong in the setup. i would appreciate it. im running sh hopefully ill get into bsh which im more confortable in. check it out thanks
1. Rename a file upon the user’s request. If the file exists, prompt the user for confirmation before renaming the file. The screen should prompt the user for
a. “Name of file you want to rename.” Use the “\c” escape character.
b. “New name of file” Use the “\c” escape character.
c. “File Exist” to avoid overriding a file.
d. “File $oldname changed to $newname”
e. “Do you want to rename another file?” If the user selects “yes” the system should refresh the screen and if the user selects “no” the system should exit to the prompt sign.
f. Refresh the screen to go back to the menu until the user selects the exit option
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Let me preface this by stating I have absolutely no idea what I'm doing in this arena, but I'm in need of a little help here.
I need to take filenames like this: amwed_0402c-slug~1-cp.jpg
And reduce them to slug~1.jpg
That is, I need to remove the first 12 and last 3 characters. The... (3 Replies)
Discussion started by: cpreovol
3 Replies
2. Shell Programming and Scripting
Hi Guys,
Here I have a simple rename script ... works perfectly fine. When files are on local machine ... But it will not work with the files on the server ...
Server is mounted
Path to the file is correct
Permissions 777
I tried couple things .. and no luck that's why I'm here :) ... (2 Replies)
Discussion started by: NDxiak
2 Replies
3. UNIX for Dummies Questions & Answers
I wrote a simple script that converts my windows text files to unix, so that I can compare them to different unix files purposes of my project.
win2unix file1.txt file1Win.txt
win2unix file2.txt file2Win.txt
etc
Is there a way to simplify this to:
<while .txt in... (5 Replies)
Discussion started by: idano530
5 Replies
4. Shell Programming and Scripting
Hello,
I have this problem.
In a directory I have 4 csv files with this format:
PHOENIX_KM_INTERAZIONI_YYYYMMDD.csv
PHOENIX_KM_TRIPLETTE_YYYYMMDD.csv
NEWCAB_KM_INTERAZIONI_YYYYMMDD.csv
NEWCAB_KM_INTERAZIONI_YYYY_MM_DD.csv
YYYYMMDD: format CURRENT date
I wont rename all files in... (4 Replies)
Discussion started by: manichino74
4 Replies
5. Shell Programming and Scripting
I have the following directories in my home directory,
my scripts
dbmig es
ms_done
my-home
I want my output to look like the following
MyScripts
DbmigEs
MsDone
MyHome
Basically, I want to get rid of spaces,special characters and convert the first letter of each word to uppercase and... (1 Reply)
Discussion started by: ramky79
1 Replies
6. Shell Programming and Scripting
Hi All,
I want to write a script to rename the file in to the incremental order
for example
Original file
filename=/nfs/n1/file1.img
filename=/nfs/n1/file1.img
filename=/nfs/n1/file1.img
filename=/nfs/n1/file1.img
filename=/nfs/n1/file1.img
I want output shpuld be... (4 Replies)
Discussion started by: mangeshpardhi
4 Replies
7. UNIX for Dummies Questions & Answers
I am trying to create a script that will search for a directory named bob, and then rename that directory to peter. I do not want the directory path to change.
so /folders/bob
would become /folders/peter
It seems to be renaming the bob folder to peter correctly, but the peter folder ends... (2 Replies)
Discussion started by: gumby456m
2 Replies
8. Shell Programming and Scripting
HI,
I have a file serverlist in that all host names are placed.
i have written a small script
#./testping
#! /bin/bash
for i in `cat serverlist`
do
ping $i >> output.txt
done
so now it creates a file output.txt till here fine..
now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies
9. Shell Programming and Scripting
I am getting out of memory issue in perl. I need to debug which function taking more memory constraints. what the commands to find out the memory consuming in the perl program. (1 Reply)
Discussion started by: ramkumar15
1 Replies
10. Shell Programming and Scripting
Hello friends!
I have a problem with my script. I'm a italian boy. Sorry for my english ehehehehehhe.
I've many files .jpg and I would like rename they in this mode:
I have not files with progressive number e I would like rename with progressive number. Example:
DSC_0012.JPG
DSC_0582.JPG... (7 Replies)
Discussion started by: vegetablu
7 Replies
LEARN ABOUT DEBIAN
rename
rename(3tcl) Tcl Built-In Commands rename(3tcl)
__________________________________________________________________________________________________________________________________________________
NAME
rename - Rename or delete a command
SYNOPSIS
rename oldName newName
_________________________________________________________________
DESCRIPTION
Rename the command that used to be called oldName so that it is now called newName. If newName is an empty string then oldName is deleted.
oldName and newName may include namespace qualifiers (names of containing namespaces). If a command is renamed into a different namespace,
future invocations of it will execute in the new namespace. The rename command returns an empty string as result.
EXAMPLE
The rename command can be used to wrap the standard Tcl commands with your own monitoring machinery. For example, you might wish to count
how often the source command is called:
rename ::source ::theRealSource
set sourceCount 0
proc ::source args {
global sourceCount
puts "called source for the [incr sourceCount]'th time"
uplevel 1 ::theRealSource $args
}
SEE ALSO
namespace(3tcl), proc(3tcl)
KEYWORDS
command, delete, namespace, rename
Tcl rename(3tcl)