![]() |
|
|
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 |
| How to check if a file exists using the if statement | Jazmania | Shell Programming and Scripting | 3 | 09-19-2008 01:32 PM |
| check if remote file exists | hcclnoodles | Shell Programming and Scripting | 2 | 08-27-2008 06:53 PM |
| Check if a file exists with certain prefix | raoscb | Shell Programming and Scripting | 11 | 08-20-2008 09:13 AM |
| check if exists a .ZIP file and unzip it using ftp | DebianJ | Shell Programming and Scripting | 1 | 05-05-2005 05:46 PM |
| perl ftp check file exists | methos | Shell Programming and Scripting | 2 | 06-18-2003 09:21 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hello friends,
I am writing a simple shell script which will copy one particular type of files to backup folder if files exists. If files doesn't exists, mv command should not be executed. My file pattern is like wcm-spider-maestro.log.2009-07-15, wcm-spider-maestro.log.2009-07-16 etc.. I have written this way find . -maxdepth 1 -name "wcm-spider-maestro.log.*" code=$? if [$code -eq "0"] then mv wcm-spider-maestro.log.* /backup fi above code working fine if files exists on current directory, if files doesn't exists, it showing message like "mv: cannot stat `wcm-spider-maestro.log.*': No such file or directory", I don't want to show that message. I tried with "ls" command also, it is also throwing some message if files not exists. Please suggest me how to move files without error messages. Thanks. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|