Renaming a file (non unix person)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Renaming a file (non unix person)
# 1  
Old 07-07-2010
Renaming a file (non unix person)

I am trying to move a file to a new file with a datestamp in the filename on a unix server using a script I am trying to write. I have searched this forum and have tried 100 different variations but cannot solve my problem.

My requirement is: Rename archiveSF\sfglsoarian.txt to sfglccyymmddhhmmss.txt


my script currently looks like this:
mv \archiveSF\sfglsoarian.txt \archiveSF\sfgl`date +%Y%m%d%H%M%S`.txt

Please help.
# 2  
Old 07-07-2010
Quote:
Originally Posted by cavleader
my script currently looks like this:
mv \archiveSF\sfglsoarian.txt \archiveSF\sfgl`date +%Y%m%d%H%M%S`.txt
Assuming you are in the parent directory of the archiveSF folder:
Code:
mv -v archiveSF/sfglsoarian.txt archiveSF/sfgl`date +%Y%m%d%H%M%S`.txt

# 3  
Old 07-07-2010
Still no good. I keep getting this same error message:
Code:
mv: target "+%Y%m%d%H%M%S`.txt" must exist
Usage: mv [-adfiqrRv] file1 [file2 ...] target


Last edited by pludi; 07-07-2010 at 03:08 PM.. Reason: code tags, please...
# 4  
Old 07-08-2010
Notice that pseudocoder is using unix solidus characters to separate the directory tree and that your original post has MSDOS type reverse-solidus characters. The solidus characters are correct in unix.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX :renaming the files present in the directory

Hi all, I am looking for a script which renames all the files from the present directory. Eg.: In unix directory contains the below files linux001.txt linux002.txt linux003.txt ...... ....... Now the files should be renamed to unix001.txt unix002.txt unix003.txt Could anyone... (8 Replies)
Discussion started by: scriptscript
8 Replies

2. UNIX for Dummies Questions & Answers

Books for person who want to be Linux/Unix administrator

Hi, I would like to become Linux/Unix administrator. Of course I am aware that it is practically impossible to get that job immediately and in the beginning it will be Junior position or 2nd level of technical support. But I would like to ask: how in-depth knowledge about daemons such like... (2 Replies)
Discussion started by: DavidMax
2 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Renaming Multiple Files in Unix

I have mulitiple files in a unix directory e.g. FILE10001.txt FILE10002.txt I want the above two files to get renamed as by a single command. I tried with mv but it does not work FILE20001.txt FILE20002.txt Paresh (6 Replies)
Discussion started by: Pash
6 Replies

4. Shell Programming and Scripting

sh script to get unix username of person executing it

Hi, I am writing a script, and I need to incorporate some logic where I can find out the unix username of the person who is executing the script. The issue is , a particular user could have "sesu" ed into a group id. for eg. root, and then executed the script. In that case, instead of root,... (5 Replies)
Discussion started by: neil.k
5 Replies

5. Shell Programming and Scripting

Remote renaming of a unix file via ftp

Hi all, i'm just after some help regarding a batch script. I'm wanting to create a windows batch script which will push a file from my pc to a unix (AIX) system via ftp. i have this part working fine but as the file i'm sending already exists i want the script to also take a sideways copy of... (6 Replies)
Discussion started by: forefather1977
6 Replies

6. OS X (Apple)

Renaming serial ports in unix

Hello everyone, this is my first post and I am by no means a unix expert, so I hope I explain my issue well. I'm on a mac (mac mini), 10.7. My question is about serial port names. I have an arduino microcontroller plugged in via usb, and every time the computer is shut down it gives the... (0 Replies)
Discussion started by: superliminal
0 Replies

7. Shell Programming and Scripting

Utility or script for renaming files on UNIX web server

Greetings! Does anyone know of a utility or a script for renaming files on a UNIX web server? I've seen several of these types of renaming utilities for Windows, but none for UNIX. I have 10,000 files that I need to rename in a several tier (deep) web site directory. I have the original... (2 Replies)
Discussion started by: everettr
2 Replies

8. UNIX for Dummies Questions & Answers

Renaming the File in UNIX

I have many files in a particular folder(all ending with extension .F1.Test). I need a unix command that will change my file extension from .F1.Test to .csv I tried giving the command as "ren sample.F1.Test sample.csv", but i got the file as "sample.F1.csv" Example : I have the filename... (8 Replies)
Discussion started by: mazhar803
8 Replies

9. Post Here to Contact Site Administrators and Moderators

Unix certified person locator

I need to locate a specific person who is certified in Unix. Please help. (1 Reply)
Discussion started by: tlwscope
1 Replies

10. UNIX for Advanced & Expert Users

Utility or script for renaming files on UNIX web server

Greetings! Does anyone know of a utility or a script for renaming files on a UNIX web server? I've seen several of these types of renaming utilities for Windows, but none for UNIX. I have 10,000 files that I need to rename in a several tier (deep) web site directory. I have the original... (1 Reply)
Discussion started by: everettr
1 Replies
Login or Register to Ask a Question