move in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting move in ksh
# 1  
Old 11-12-2008
move in ksh

Hello everybody:

I wanted to rename some files by adding date at the end. I wanted to assign the new name to a variable. Following is the code

REMOTE_FILE="/abc/data/test.csv"

mv /abc/data/test.csv /abc/data/"`date '+test_%Y%m%d'`".csv

REMOTE_FILE="/abc/data/"`date '+test_%Y%m%d'`".csv"


Question:
1. Is the above code correct? The expected result would be 'test_20081112.csv'
2. There are multiple files e.g. test1.csv, test2.csv, test3.csv; I believe I have to use loop as following but not sure.

for each in *.csv;
do
mv $each /abc/data/"`date '+test_%Y%m%d'`".csv
done


I would appreciate any help.
Thanks.
# 2  
Old 11-12-2008
Guess the only true way to know is to test it Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check for files and move it to another directory - ksh

I'm trying to wirte ksh script for given requirement, but i unable to achive it. In dir1 directory I need to check for the files which suffixed with .csv or .txt, If there is no files, then i need to exit. If any files found I need to move the each file found to dir2 directory. I have to repeat... (4 Replies)
Discussion started by: Kayal
4 Replies

2. AIX

Move data LV

hello everyone, this is my first post in this forum, I hope I am in the right place :) I am relatively new to AIX, and I need help doing the following: move data from directory /universe_log/CIHPRD to /universe_log/novabch1 while changing lv and preserving mount point. below some... (7 Replies)
Discussion started by: Tarik36
7 Replies

3. Shell Programming and Scripting

find command to move the files to other folder - ksh 88

Hi , I've learnt that the following command will remove the files from the given folder for given no.of days find /home/etc -type f -atime -10 -exec rm -f {} \; But how can I change the above command that will move the files to another specified directory instead of removing the... (1 Reply)
Discussion started by: smile689
1 Replies

4. AIX

Move directory

Hi All, please help me with the command for moving/copying one directory(including subdirectories) to one directory in another mount point in same server in AIX ... thanksss (7 Replies)
Discussion started by: Sanal
7 Replies

5. Shell Programming and Scripting

Find and move

Hello All, /storage3 /storage4 I have written a shell script to locate files older than 7 days in /storage4 folder and move to /storage3.At the same time it will take output as number of files moved and log in a .txt file. It will also find files in /storage3 older than 90 days and remove... (4 Replies)
Discussion started by: Siddheshk
4 Replies

6. AIX

Move LV to a different PV (same VG)

Hi guys, I need some assistance moving a LV. :D I have a VG with two PV; on the second PV there is only one LV so I want to move it to the first PV (hdisk1) in order to get rid of the second one (hdisk2) Something like (pseudocode): move MyLV from hdisk2 to hdisk1 How can I achieve that? (4 Replies)
Discussion started by: verdepollo
4 Replies

7. Shell Programming and Scripting

different behaviour for ksh and ksh -x

I'm getting different behaviour when executing below script in debug option. $ cat ss.ksh ff=$(pwd) echo " ff : $ff" $ ksh ss.ksh ff : /tmp $ ksh -x ss.ksh + + pwd ff= + echo ff : ff : I was getting this behaviour in my actuall script i'm able to reproduce this in simple script... (4 Replies)
Discussion started by: luckybalaji
4 Replies

8. UNIX for Dummies Questions & Answers

Difference Between executing llike ./myscript.ksh and . ./myscript.ksh

Hi , What is the diffence between executing the script like ./myscript.ksh . ./myscript.ksh I have found 2 difference but could not find the reason 1. If i export a variable in myscript.ksh and execute it like . ./myscript.ksh the i can access the other scripts that are present in... (5 Replies)
Discussion started by: max_hammer
5 Replies

9. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

10. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies
Login or Register to Ask a Question