![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| renaming xls file | systemsb | UNIX for Dummies Questions & Answers | 2 | 10-19-2007 08:50 AM |
| Help in renaming file !!! | kumarsaravana_s | UNIX for Dummies Questions & Answers | 5 | 05-02-2007 01:45 PM |
| Mass file renaming | Indalecio | UNIX for Dummies Questions & Answers | 5 | 12-30-2006 05:16 AM |
| Renaming a file name | dbrundrett | Shell Programming and Scripting | 2 | 01-06-2004 10:36 AM |
| Renaming a file to the same name | lachino8 | UNIX for Dummies Questions & Answers | 3 | 07-31-2002 09:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi, I am new to Shell programming, can any one help me with a shell program which can find a file and the rename it with a current datestamp and move it to a different directory. Advices/suggestions are welcome and Thanks in advance.
![]() |
|
||||
|
I am trying something like this..
cd /in # Go to in the folder. if [ -f "$File.xml"]; then # Check for the file if it exists mv projects.xml ../program # move the file to program directory fi cd ../program # cd to the program directory run command # run the command. It throws me a error something like this, Please advise.. file.sh: [: missing `]' ??? |
|
||||
|
Hey Thanks but while i use the below code, there isnt any error, but the file is not getting moved.. Is there any reason why? the file name lying unde is projects.xml, which i am trying to move to xog folder...
cd in if [ -f "$projects.xml" ] ; then mv "$projects.xml" ../xog fi |
|
|||||
|
Quote:
See what happens in the debugging mode Enable the debug option. Put a Code:
set -x before the "if [ -f.." and Code:
set +x after the "fi" |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|