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



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
shell script for delete old files krishnarao Shell Programming and Scripting 4 01-13-2009 04:33 AM
shell script to delete directories... Stephan Shell Programming and Scripting 8 05-18-2008 11:00 AM
shell script to delete directories... Stephan Shell Programming and Scripting 5 05-16-2008 08:11 AM
Shell Script --- Delete ORA error from data file sk005 UNIX for Dummies Questions & Answers 1 09-25-2007 05:26 PM
how to delete empty files in a shell script rpnuge UNIX for Advanced & Expert Users 1 07-11-2002 04:56 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-07-2005
r3edi r3edi is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 3
Question Need Help: Delete a file by Shell Script

Need some help here.

We FTP out files to another server hourly. But before we can FTP to the other server. That server should send our server a "confirmation file" to tell us that they're ready to receive data. If they don't send the confirmation file, the files on our server should just stay until the next confirmation file. After sending the files to the other server, our script is supposed to delete the "confirmation file".

A script (with .scr filename) runs a shell script (with .sh filename). The shell script is the one which is supposed to delete the "confirmation file" after FTPing the files to the other server. Our problem right now is that the file that's supposed to be FTPed to the server is successfully FTPed BUT the "confirmation file" does not get deleted in the directory.

Any ideas on why a file does not get deleted by a shell script?
  #2 (permalink)  
Old 07-07-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Post that part of the script which is supposed to do the deleting.

Are you using mdelete or delete to delete the file on the remote machine ?

Also, you might not have the delete permissions on that remote machine. A write permission does not mean you have delete permission as well.

Vino
  #3 (permalink)  
Old 07-10-2005
r3edi r3edi is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 3
how do i know if the user of the script has delete permission and not just write permission?


Here's the part of the script which should have deleted it?
rm root directory/directory/file
  #4 (permalink)  
Old 07-10-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by r3edi
how do i know if the user of the script has delete permission and not just write permission?

Here's the part of the script which should have deleted it?
rm root directory/directory/file
You cant just rm a remote file on an ftp server. You need to use the delete command.

I am not sure, how you can set the delete permissions (via command line) for a user.

I use Cerberus FTP Server, and since it has an UI, I can set the required permissions for different user.

Vino
  #5 (permalink)  
Old 07-11-2005
r3edi r3edi is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 3
What if the file that needs to be deleted is in the same server as the script? I still can't use rm ?

It's actually an EDI Gentran UNIX server.
  #6 (permalink)  
Old 07-11-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Once you are inside an ftp session, issue help

That will show you the commands that you can give at the ftp prompt.

Again, if you are inside an ftp session, then you could try this to remove a local file

Code:
ftp> !rm sample.txt
That should remove the sample.txt on your local machine

Vino

Last edited by vino; 07-11-2005 at 07:19 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0