Help using Base SAS procedures

using rcmd -delete folder containing files - on ftp server

Reply
Occasional Contributor
Posts: 19

using rcmd -delete folder containing files - on ftp server

I basically want to delete a folder 'test_fldr' on ftp server, and can not because folder is not empty.
tried rcmd='rmd /Test/test_fldr' (folder not empty)
tried rcmd='rmd -r /Test/test_fldr' (invalid file name, apparently -r is not recognized)

problem:
so decided to delete files in the folder first, as you see in following code
rcmd='dele *.*' debug does not work.

%macro del_temp;
filename del ftp 'x'   /* it doesn't work with empty ' ', so decided with x */
/* connect */
        host='111.111.111.111'
        user='abcd'
        pass='YYYYYYYYYYY'  
/* change directory */
        cd='/Test/test_fldr'
        rcmd='dele *.*' debug  /* struck here: extrct from log  "NOTE: <<< 550 *.*: The filename, directory name, or volume label syntax is incorrect. "
        ;
data _null_;
file del;
run;
%mend;

%del_temp


any help would be appreciated.

Trusted Advisor
Posts: 3,211

Re: using rcmd -delete folder containing files - on ftp server

This is not a SAS issue. The ftp server is allowing some commands and there will be restrictions as of security on those files.

Try to find those and after that you could go on with the attempt using the SAS interfacing. (rcmd usage)

---->-- ja karman --<-----
Super User
Super User
Posts: 7,942

Re: using rcmd -delete folder containing files - on ftp server

Concur with Jaap, also to add there is probably a very good reason why deleting things via ftp is not allowed!  Even local file deletion should be undertaken with extreme caution, and backups.

Ask a Question
Discussion stats
  • 2 replies
  • 458 views
  • 0 likes
  • 3 in conversation