Intermec Home

How to Buy | Partner Login


Developers Forum

Reply
VC Access
stusicluke
Posts: 1
Registered: ‎January 25 2012
0

Deleting files in SSConfigDir folder

Hi!

 

I'm developing a pogram that copies some files to the 'SmartSystems\SSConfigDir' and then waits for their respective output files (for example, if the file copied is 'wifi.xml', it will look for 'wifi.xml_out').

Before this, the program already checks for the 'SaveCfgFiles=1' value in the registry (HKLM\Software\Intermec\SSClient).

 

Before copying files, I need to ensure that the folder is empty, so I try to delete any file in there. C# code follows:

 

try
            {
                String[] files = Directory.GetFiles(@"\SmartSystems\SSConfigDir");
                foreach (String f in files)
                    Directory.Delete(f);
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Deleting files", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                return false;
            }

 

I'm getting a System.IO.IOException every time: "Access to the path '\SmartSystems\SSConfigDir\Phone.xml_ss' is denied"

 

Is deleting forbidden by any reason? If so, is there a way to clean all the files in the folder (maybe using another xml in SmartConfig to delete all files...)??

 

Thank you in advance

Super Contributor
rHeller
Posts: 105
Registered: ‎March 3 2009

Re: Deleting files in SSConfigDir folder

[ Edited ]

Your trying to delete a file right?

 

Wouldn't you want to use File.Delete() instead of Directory.Delete()?

 

File.Delete Method