Computing.Net > Forums > Unix > Script remove file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script remove file

Reply to Message Icon

Name: hoan0202
Date: May 10, 2006 at 12:59:09 Pacific
OS: unix
CPU/Ram: 2000
Product: 2000
Comment:

cd /export/home/ca7prod
/export/home/ca7prod> ls -l rnc*
-rw-rw-r-- 1 ca7prod ops 999 May 10 11:37 rnc
-rw-rw-r-- 1 ca7prod ops 999 May 10 11:25 rnc.txt

I really need help how to write a script to delete or remove the ".txt" file. If anyone know please help. Thanks alot.

#!/bin/ksh

PATH=/export/home/ca7prod

rm -f *.txt

exit=0


Something like this ????



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: May 10, 2006 at 13:34:32 Pacific
Reply:

You are close, but it's not a good idea to change PATH without a good reason. Do something like this:

#!/bin/ksh
# remove all files with a 'txt' extension
# in this directory
cd /export/home/ca7prod

rm -f *.txt

exit 0


0

Response Number 2
Name: hoan0202
Date: May 10, 2006 at 14:11:49 Pacific
Reply:

Thanks alot Mr.nails. That script really work for me. Thanks again....... :) :) :)


0

Response Number 3
Name: hoan0202
Date: May 10, 2006 at 15:07:25 Pacific
Reply:

This script is work and I really need help how to setup to hide the password in the script. Mr.nails.......please help.

#!/bin/sh
ftp -in <<END
open ps1780-1
user ca5prod workhard (usr=ca5prod, pwd=workhard)

cd /staging/Q3/data_source_raw/hospital_billing/S/inpatient

mdir testfolder

quit

!



0

Response Number 4
Name: ghostdog
Date: May 12, 2006 at 22:58:35 Pacific
Reply:

actually you could just set the correct user permissions to the script. ie , who has the rights to execute and view the script.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Script remove file

Unix script remove files older 1mon www.computing.net/answers/unix/unix-script-remove-files-older-1mon/5971.html

removing files / match criteria www.computing.net/answers/unix/removing-files-match-criteria/7858.html

Remove files command www.computing.net/answers/unix/remove-files-command/7948.html