Renaming script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Renaming script
# 1  
Old 12-01-2002
Renaming script

iam looking for a PERL script to goto a folder and rename all the files in it.can some one help me please?
# 2  
Old 12-01-2002
I could possibly help you ...

How would you like to rename them? Change an extension? Number them?

How do you know which folder? Pre-defined? Ask at run-time?
# 3  
Old 12-01-2002
I would like to rename the file name (e.g test1.txt to test.txt)
for the folder, ask at run time. ( can you also tell me the command for a pre-defined please)

thanks
# 4  
Old 12-02-2002
What system is it for? Unix or Windows? And what's it for, by-the-way?
# 5  
Old 12-02-2002
its for win98 or unix. its basicly to get the file in the folder and rename them,so i can put others in with that same name (before the others were renamed) so that if theres a problem with the new files i put in, i simply rename d others back to d original
# 6  
Old 12-02-2002
Haven't quite had the chance to properly test this - and it's aimed at Windows machines; but here you go! Give it a try and let me know!
Code:
...

See below for improved WORKING version! Smilie

Last edited by WIntellect; 12-02-2002 at 05:05 PM..
# 7  
Old 12-02-2002
getting loads of errors!!!! any other idea
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script for batch renaming

What is wrong with this script to rename batch of similar files? For example renaming all *.txt files to *.tab . $ for i in seq {01..10}; do touch ${i}.txt; done $ ./rename.sh *.txt txt tab Error: mv: ‘01.txt’ and ‘01.txt’ are the same file. Code is: #!/usr/bin/bash # renames.sh #... (6 Replies)
Discussion started by: yifangt
6 Replies

2. Shell Programming and Scripting

Cronjob script not renaming file

Hello, I have below script, which connects to ftp server, pull a file and then it renames it after deleting previous day file. This was working before but now it is not able to rename 'Red_bill.txt' to `Red_bill.V01.txt`. If I run manually 'rename Red_bill.txt Red_bill.V01.txt', I am able to... (5 Replies)
Discussion started by: solaris_1977
5 Replies

3. UNIX for Dummies Questions & Answers

Script for renaming multiple scripts

Hi There I am looking at writing a script that I can run from a cron job (say every month) that will copy my existing scripts to another folder, then in THAT new folder, append them all with the extension of .txt I have the cp command down pat (cp /existing_folder /new_folder) however I am... (6 Replies)
Discussion started by: orangepeel
6 Replies

4. Shell Programming and Scripting

Script help required in renaming

Given a directory containing 10 files: 1 - abcd1.txt 2 - abcd2.txt . . 10 - abcd3.txt 1 )Write a one liner sh script* to rename all files that start with a number less than 10, to have a zero in front. ie. 1 - abcd1.txt will be renamed to 01 - abcd1.txt. * You may not make use... (1 Reply)
Discussion started by: learnbash
1 Replies

5. Shell Programming and Scripting

Copying and Renaming script

Hey all! Sorry for the noobish question.. I am wondering how to I copy multiple files, and rename them based on their directory at once. So, I have files like this /logs/server/2011-10/server-1/log/file/folder/some.log.gz /logs/server/2011-10/server-2/log/file/folder/some.log.gz... (3 Replies)
Discussion started by: m3power206
3 Replies

6. Shell Programming and Scripting

Need script for renaming and moving files one by one...

Dears, I need your help! I got a problem and found some workaround solution but I donno how to realize it. I have a number of files (about 300 each day) and I need them to be renamed. All these files has fixed number of letters and name looks like this one:... (7 Replies)
Discussion started by: nypreH
7 Replies

7. Shell Programming and Scripting

Script for renaming files

I wanna back up the original version of files in a directory by appending .ORIG to them. I'm guessing I'd need CP and AWK in some form or fashion. Can someone give me a template? Thanks (3 Replies)
Discussion started by: stevenswj
3 Replies

8. Shell Programming and Scripting

script for renaming a batch of files

hi i have a folder full of files. some of the names are quite off because the dimensions were the same and i had to put a 'b' after the initial number so that it didnt overwrite. what i want is a script in unix to overwrite the filwe name leaving some of the title intact, e.g. below are some... (3 Replies)
Discussion started by: shabs1985
3 Replies

9. UNIX for Dummies Questions & Answers

Renaming Files using Shell Script

Hi Gurus, I have some files(all ending with .out as extension). Ex: aa1.out aa2.out aa3.out I would like to append each file with the current date to the end of the file so that they should become aa1_20090504.out. So I am using rename as follows: for i in path/aa* ; do mv $i... (5 Replies)
Discussion started by: asmfloyd
5 Replies

10. Shell Programming and Scripting

Renaming files in a bash script

I'm doing a short batch script to compile po files producing output binary mo files. The compilation command is: msgfmt -o file.mo file.po so in order to compile I am appending .mo to the varible in a loop. It goes something like this: for i in `find . -name "*.po"` do echo... (2 Replies)
Discussion started by: Breen
2 Replies
Login or Register to Ask a Question