Delete Folders in /home/dev/unsecured/ with PACControl

Trying to delete all files and subdirectories in /home/dev/unsecured/ OR any subdirectory that’s created when Writing to a File with PACControl.

Yes it can be done with NODE-RED (rm -r /home/dev/unsecured/) but this is an OEM customer and trying to keep everything within PACControl since this will be at multiple locations with possibly different versions of node-red, etc.
Basically PACControl is just cleaner for them.

Currently tried the following
XFER_WRITE_STATUS = SendCommunicationHandleCommand(chXFER_FILE, “delete”);

Able to delete individual files under the subdirectory - com handle setup as follows:
XFER_COM_HANDLE = “file:w,/home/dev/unsecured/PARAMETER/TUNE_F.TXT”;

Tried several variations to delete the directory (in this case PARAMETER) with no success.
I do not get a command status failure (zero) but nothing is deleted.

Any ideas on how to delete the PARAMETER sub-directory or a mass delete under a directory via PACControl would be welcome.

Linux won’t let any old user delete a directory that is not empty. So that option is out.
Mass delete from PAC Control is just not a firmware command (yet). I can add the request, but that option will be off the table until that option is added.

Best thing I can think of is to write a loop that reads the file names and then deletes them by name.

Thanks Ben - will I then be able to delete the directory ?
If so then would the com handle be:
“file:w,/home/dev/unsecured/PARAMETER"

As a follow up - tired several permutations of the previous communication handle but cannot delete the subdirectory.

Never thought of it before but can’t delete the subdirectory through groov Manage either.

Any non NODE_RED or Shell Access way to delete subdirectories ?

Lou,

Sorry, I am a little slammed here to test this before I reply, but did you try the FTP commands?

image

From page 106 of the pac control command reference. Doc 1701.

Thanks Ben,
These commands are a blast from the past. Used to use for internal SNAP files but haven’t done so in years.

I did try with EPIC but no luck.

Not sure if I setup the Communication handle correctly since I get a -447 error (ftp connect failed).
I did setup the EPIC to accept communication on port 21 and 20. However did not reboot the EPIC (did save and everything updated).

Com Handle set as “ftp:127.0.0.1:21,m,m”

Let me know if I screwed up with the com handle.
Would directory structure be the same as EPIC to access (/home/dev/unsecured/) ?

Its one of those problems I know can be done. However if push comes to shove I’ll setup Node Red. Was trying to avoid one more thing that the OEM needs to setup for each system.

The EPIC does not support FTP (we discourage it - but have a guide on how to install it via shell here; http://developer.opto22.com/epicdev/shell/vsftpd/) at all, so my thought was to use them with a tcp: com handle… Just in the off chance they would work in that (oddball) way.

Worth a shot. At least now I don’t feel too bad I couldn’t do with FTP.
As I said haven’t used the ftp commands in years (better way to do things now).

The issue was trying to delete directory and files via PACControl.
Any other ideas you may have would be welcome.

Thanks for your help.