The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-10-2009
graysky graysky is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 13
Thumbs down bash script quesiton - if any file exists then ...

I'd like a bash script to simply check to see if any file/files are present in a source directory, and if so move it/them to a target directory.

I have this but it doesn't work:

Code:
#!/bin/bash
 
 if [ -e /source/* ]
then
  mv /source/* /target
fi
What is the right syntax? Thanks!