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.

Ben, want to revisit the question of directory and how to delete files created by PACControl in regard to the EPIC Controller

I’ve setup the system to delete preset files (verses dynamic names) but still run into an issue with dynamic filenames.
FYI - I tried the several permutations of the rmdir command within PACControl with no luck - if this works can you provide Communication Handle format and Send Communication Handle Command examples - because what I’m trying is giving me an error

Since Files and directories created by PACControl cannot be deleted by Node Red (at least simply):

  • Is there a way to use the PACControl user account in Node Red?

  • SUDO doesn’t work in Node Red or can it ? (I get a lecture that I shouldn’t do this when I try but it doesn’t work)

  • How do you delete directories via Groov Manage ?
    I’ve done it will SSH but this is for an OEM customer and they don’t want their customers having that type of access.

  • Anyway to wild card delete contents of directory in PACControl?

The issue that I have is we are creating files on the drive (via PACControl) and want a means to blow everything away without SSH or Groov Manage access. Node Red was my go to to delete directories but I get locked out until I delete files via PACControl. This works when I know all the filenames but if unknown not sure how to do.

The software engineers have addressed this core issue.
It requires both new EPIC firmware and a new version of PAC Control that has the new comm handle commands.
Both are in QA at the moment. I don’t have a firm release date for those two releases but I know its weeks, not hours if that helps.

Because of the way Linux handles users and security in general, we don’t have any non-shell work arounds.

Thank you for the quick response.
As always - greatly appreciated.