delete a file that found on different machine

delete a file that found on different machine

Post by Alon » Fri, 27 Jun 2003 22:34:00



Hi,

How can I delete a file that found on different machine?
Both of the machines have UNIX system,
And i am programming in C.

regards,
Alon

 
 
 

delete a file that found on different machine

Post by Marc Rochkin » Fri, 27 Jun 2003 22:44:23



> Hi,

> How can I delete a file that found on different machine?
> Both of the machines have UNIX system,
> And i am programming in C.

> regards,
> Alon

Two cases:

1. There is a path to the file. That is, the file system it's on is mounted
with NFS or something equivalent. In that case, you just issue the system
call (unlink) as though it were local.

2. It is not mounted. I haven't a clue what to do in this case. Not sure
how it would even be "found."

--Marc

 
 
 

delete a file that found on different machine

Post by Alon » Fri, 27 Jun 2003 23:02:31


The file system is not mounted.

I want to know if there is a command similar  to 'ssh' that allow to delete
a file
on remote computer, or maybe I can use the 'ftp' command someway.

regards,
Alon



> > Hi,

> > How can I delete a file that found on different machine?
> > Both of the machines have UNIX system,
> > And i am programming in C.

> > regards,
> > Alon

> Two cases:

> 1. There is a path to the file. That is, the file system it's on is
mounted
> with NFS or something equivalent. In that case, you just issue the system
> call (unlink) as though it were local.

> 2. It is not mounted. I haven't a clue what to do in this case. Not sure
> how it would even be "found."

> --Marc

 
 
 

delete a file that found on different machine

Post by Alon » Sat, 28 Jun 2003 00:03:20


Is there a way to delete a file on remote computer in a single line like
that:
ftp host | echo username | echo password | echo mdelete file.c

I know that this line doesn't work, but if I can alter its syntax
that will make it to work, I will be able to call this line from c program
like this:

system("ftp host | echo username | echo password | echo mdelete file.c") ;

Any help will be very appreciated.
regards,
Alon

 
 
 

delete a file that found on different machine

Post by Carl McGuir » Sat, 28 Jun 2003 00:28:50



> Is there a way to delete a file on remote computer in a single line like
> that:
> ftp host | echo username | echo password | echo mdelete file.c

> I know that this line doesn't work, but if I can alter its syntax
> that will make it to work, I will be able to call this line from c program
> like this:

> system("ftp host | echo username | echo password | echo mdelete file.c") ;

> Any help will be very appreciated.
> regards,
> Alon

Have you considered rsh/remsh? You can use .rhosts on the target machine
and don't need to pass or store the password.

Carl

 
 
 

delete a file that found on different machine

Post by Anna Se » Sat, 28 Jun 2003 02:30:56



> Hi,

> How can I delete a file that found on different machine?
> Both of the machines have UNIX system,
> And i am programming in C.

You can use ssh w/out password prompting, if you set it up to use public
key authentication.  See the man pages for ssh.


-Anna-

 
 
 

delete a file that found on different machine

Post by Peteris Krumin » Sat, 28 Jun 2003 03:04:49



Quote:> Is there a way to delete a file on remote computer in a single line
> like that:
> ftp host | echo username | echo password | echo mdelete file.c

> I know that this line doesn't work, but if I can alter its syntax
> that will make it to work, I will be able to call this line from c
> program like this:

> system("ftp host | echo username | echo password | echo mdelete
> file.c") ;

You can use an 'expect' script for this, which would automate logging into
the ftp server and removing the file.

P.Krumins

 
 
 

delete a file that found on different machine

Post by David Schwart » Sat, 28 Jun 2003 03:26:51



Quote:> The file system is not mounted.

> I want to know if there is a command similar  to 'ssh' that allow to
delete
> a file
> on remote computer, or maybe I can use the 'ftp' command someway.

    Why not use 'ssh'?

    DS

 
 
 

delete a file that found on different machine

Post by William Aher » Sat, 28 Jun 2003 06:23:54



> Is there a way to delete a file on remote computer in a single line like
> that:
> ftp host | echo username | echo password | echo mdelete file.c

> I know that this line doesn't work, but if I can alter its syntax
> that will make it to work, I will be able to call this line from c program
> like this:

> system("ftp host | echo username | echo password | echo mdelete file.c") ;

> Any help will be very appreciated.
> regards,
> Alon

try curl. it excels at automating ftp from scripts. however, the best
solution is ssh. just do:

        ssh some.host "rm /path/to/file"

in either case, putting the password as a commandline argument is a no-no.
(the commandline is readable by anybody, using top). for ssh, generate a key
on one side (.ssh/id_dsa.pub) and put it into the
.ssh/authorized_keys on the other side.

otherwise, your standard ftp client as well as curl should be able to read
the username/password for an ftp host from ~/.netrc. an example .netrc might
be:

        machine some.host login jsmith password zyxwabcd

voila!

- Bill

 
 
 

delete a file that found on different machine

Post by Alon » Mon, 30 Jun 2003 14:14:03


Thanks all,
Alon
 
 
 

delete a file that found on different machine

Post by Alon » Mon, 30 Jun 2003 14:49:38


Now i'm informed that i'm not allowed to used ssh
or any other software that needed to be specially installed, so curl is also
not appropriate.

How can I do that by using system()  to call the ftp command or script file?
Can you show me an example of such script?
because when im calling the ftp command by script, the next lines in the
scripts
that supposed to enter the username and password are launced after the
ftp process is over.

thanks,
alon



> > Hi,

> > How can I delete a file that found on different machine?
> > Both of the machines have UNIX system,
> > And i am programming in C.

> You can use ssh w/out password prompting, if you set it up to use public
> key authentication.  See the man pages for ssh.


> -Anna-

 
 
 

delete a file that found on different machine

Post by David Schwart » Tue, 01 Jul 2003 06:26:11



Quote:> Now i'm informed that i'm not allowed to used ssh
> or any other software that needed to be specially installed, so curl is
also
> not appropriate.

    Informed by whom? Is this an academic exercise or a practical one?

    DS

 
 
 

delete a file that found on different machine

Post by Oleg Goldshmid » Tue, 01 Jul 2003 20:37:41



> Now i'm informed that i'm not allowed to used ssh
> or any other software that needed to be specially installed, so curl is also
> not appropriate.

Are there still UNIX systems that don't come with ssh out of the box? Hmm...

Quote:> How can I do that by using system()  to call the ftp command or script file?
> Can you show me an example of such script?
> because when im calling the ftp command by script, the next lines in the
> scripts
> that supposed to enter the username and password are launced after the
> ftp process is over.

Put the commands, including delete, in a file. Then do

$ ftp -i < file

Make ftp use ~/.netrc for authentication.

--

 
 
 

delete a file that found on different machine

Post by Alex Colvi » Thu, 03 Jul 2003 06:58:04


Quote:>> How can I delete a file that found on different machine?
>> Both of the machines have UNIX system,
>> And i am programming in C.
>Two cases:
>2. It is not mounted. I haven't a clue what to do in this case. Not sure
>how it would even be "found."

I had a working solution to #2, but somebody out there deleted it :-)

Seriously, you can also use FTP to delete files on a machine that is
willing to give you an FTP connection.
--
        mac the na?f

 
 
 

1. search and delete different files in different directories

Good day,

I need to write a shellscript and I hope you can help me:

I have got 30 directories, each has a different name. In the
directories, files are stored which are built up like this: XXX.000,
XXX.001 ....up to XXX.500

XXX can be everything from i.e. test1(.066) to actock77(.003).

Now I need to find the file with the highest extension (i.e. XXX.050)
and delete all files that have a lower extension (XXX.000 - XXX.049),
so that only XXX.050 remains. Approximately 2300 files are to be
deleted.

After that, the computer should switch to the next directory and
continue the progress.

With kindest regards,

Chris

2. home rolled root disk? (slackware)

3. Find finds deleted files??!!??

4. password length

5. NFS /home directory : Different machines need different desktops

6. Bluetooth fixes for 2.4.21-pre2

7. /etc/passwd - different on different machines?

8. Dual booting Solaris 7 and 8 - need assistance

9. NIS: Different userids on different machines?

10. Same command, same os, different machines, different results

11. /etc/passwd - different on different machines?

12. Find a string, delete that line, delete 1 line before it and all lines after it...

13. rcp --> delete file on another machine?