LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-04-2002, 08:11 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
how to delete the contents of a directory using smbclient?


I need to smbclient into a machine and delete a directory - I'm on a Linux box, but the directory to delete is on a windows box. I want to do it as a one line command so I can write a script to do the same thing on several computers... here's the setup:

smbclient //node001/c$ power -UAdministrator

get's me into the computer.
the directory that needs to be removed is /co_274/rib/scenes/ (I really only need to delete the files in that directory, but deleting the whole directory is fine.)

I've tried:
smbclient //node003/c$ power -UAdministrator -c co_274/rib/scenes ;
smbclient //node003/c$ power -UAdministrator -c co_274/rib/scenes/*.rib ;
smbclient //node003/c$ power -UAdministrator -D co_274/rib/scenes/ -c rm *.rib ;

but none of them seem to work. If I use the -D without the -c, it does start up in the correct directory, but with the -c, I get "no match"

I will eventually write a script to do this on "node001 - node025"

any ideas?

Thanks

Last edited by BrianK; 09-04-2002 at 09:01 PM.
 
Old 09-04-2002, 09:13 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Here is a link that should give you your info:

<http://www.linuxprinting.org/man/smbclient.html>


You might try enclosing the commands listed after the -c flag in quotes. I think the file-globbing should be done in the smbclient command and not the shell.
 
Old 09-05-2002, 02:46 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally posted by jschiwal
Here is a link that should give you your info:

<http://www.linuxprinting.org/man/smbclient.html>


You might try enclosing the commands listed after the -c flag in quotes. I think the file-globbing should be done in the smbclient command and not the shell.
yeah, I checked the man page (the link you gave me)... it was the quotes that I was missing that was causing it not to work. I also needed to do -c "cd foo/bar; rm *.rib" as opposed to -D dir -c rm

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot list directory contents kpachopoulos Linux - General 2 11-29-2005 05:24 PM
Empty directory contents stefaandk Linux - General 1 08-22-2005 07:03 AM
smbclient spaces in directory names? darkleaf Linux - Networking 2 11-23-2004 02:25 PM
mv the contents of one directory to the parent directory warkrime Linux - Newbie 4 07-14-2003 07:03 PM
Get directory contents vank Programming 6 10-19-2002 10:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration