Script that, if file exists in Samba share, moves file to Unix server

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Script that, if file exists in Samba share, moves file to Unix server
# 1  
Old 05-09-2012
Script that, if file exists in Samba share, moves file to Unix server

I'm looking to do pretty much what the title says.

I want a script that runs, it can run on Unix or Windows, doesn't matter, and searches a Samba shares for a .txt file.

If the file exists, the script will move (or possibly copy) the file from the Samba share into a directory on our Unix server.

It should check for a file every 15 minutes.

I'd prefer to do this from within Unix just because I'm trying to learn more about Unix, but Windows works too.
# 2  
Old 05-09-2012
What have you tried?

How do you think this would be accomplished? What commands?
From your unix login, can you 'see' the file you are checking for? Do you have to connect to a different computer to find the file?
We are here to help, but not do all the work for you.
# 3  
Old 05-09-2012
Certainly, I need to get more specifics, I was just tasked with this and don't quite have all of the details. I think I should be able to use cron for this? It's a bit hazy as its been a year or so since I worked with Unix and I've never been an expert by any stretch. Does this sound like something that could be accomplished with cron?

Last edited by twcostello; 05-09-2012 at 12:23 PM..
# 4  
Old 05-09-2012
Cron is a way to schedule unix programs or scripts to run on a regular basis. However, you have to create the script first.

script.sh
Code:
if s:\path\folder\filename exists
  then 
    move the file somewhere
endif

then in cron, you would add script.sh to the list of scheduled programs
and be sure to code all those first fields correctly to have it run every 15 minutes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Force file ownership of a domain user in samba Share

Hi, I am using RedHat 6 and ,I am trying to force a domain user (from Windows AD) to take ownership of a file when it is created, or copied on a Samba share. I have managed to get this working for the root user using the code below: COMMENT = IT Data Share path =... (2 Replies)
Discussion started by: p2bas
2 Replies

2. UNIX for Advanced & Expert Users

How to get file from share drive when filename with spaces using samba client?

Hi Team, I am not able to get file name from shared drive when filename have spaces in it. following command i am using. filename="REP00105 - ABC XYZ (SCM)_ 1.TXT" /hfx/opt/samba220/bin/smbclient \\\\${nt_host}\\${nt_share} ${NT_PASSWORD} -U${NT_USERNAME} -c "cd ${nt_directory}; prompt;... (1 Reply)
Discussion started by: Makarand Dodmis
1 Replies

3. Shell Programming and Scripting

Unable to check if file exists on remote server using expect

Hi, I need to check if a file exists on remote server using expect. #!/bin/bash ip_addr=10.10.10.10 user=root passwd=Help filename=/root/test expect -c " spawn ssh -n -T -o NumberOfPasswordPrompts=3 -o StrictHostKeyChecking=no $user@$ip_addr expect \"*?assword:*\" send --... (6 Replies)
Discussion started by: temp_user
6 Replies

4. Shell Programming and Scripting

ssh to remote server and check if file exists

Hi everyone, I am trying to figure out a way to ssh to remote server and check if file exists, and if it doesn't I want to leave the script with an exit status of 5. I have the following that I am attempting to use, but it is not returning anything: check() { ssh ${SOURCE_SERV} "ls -l... (4 Replies)
Discussion started by: jimbojames
4 Replies

5. Solaris

samba issue: one samba share without password prompting and the others with.

Hi All, I've been trying to configure samba on Solaris 10 to allow me to have one share that is open and writable to all users and have the rest of my shares password protected by a generic account. If I set my security to user, my secured shares work just fine and prompt accordingly, but when... (0 Replies)
Discussion started by: ideal2545
0 Replies

6. Shell Programming and Scripting

Script to check for the file existence, if file exists it should echo the no of modified days

Hi, I am looking for a shell script with the following. 1. It should check whether a particular file exists in a location #!/bin/sh if ; then echo "xxx.txt File Exists" else echo "File Not Found" fi 2. If file exists, it should check for the modified date and run a command... (2 Replies)
Discussion started by: karthikeyan_mac
2 Replies

7. Linux

Samba share script

Hi everyone! I'm trying to run a script when a folder is shared and when it stop being shared. Is there something like .start_share or .stop_share scripts in Samba where I could run some commands?:confused: edit: maybe with a wrapper in smbmount but I share folders via nautilus. Any ideas? (0 Replies)
Discussion started by: funyotros
0 Replies

8. Shell Programming and Scripting

Need to write a script in UNIX to find a file if another file exists

So I have a lot of Java applications on my servers all having their own folder from the applications subdirectory. Now, I need to do the following. Search all the applications subdirectories for message.jar. If the message.jar file exists, I need to search the application directory for... (1 Reply)
Discussion started by: mmdawg
1 Replies

9. Shell Programming and Scripting

Check File Exists and compare to previous day file script

We have data files that are ftp'd every morning to a SUN server. The file names are exactly the same except for that each has the date included in its name. I have to write script to do 2 things: STEP 1) Verify that the file arrived in morning. STEP 2) Compare the file size of the current... (3 Replies)
Discussion started by: rbknisely
3 Replies

10. Shell Programming and Scripting

unix script to check whether particular file exists and to find its size

I want to find the size of particular file exists in a particular directory and i wnt to zip it. In the below mentioned code it should check the MQ.log in the particular directory.Please correct my code so that it will check for particular MQ.log but i could not able to check whether the... (9 Replies)
Discussion started by: Balachandar
9 Replies
Login or Register to Ask a Question