Hello all
I'm trying to find the right syntax to remove a directory using the rmdir option in the Utility>Dir class. I've tried every possible syntax variation I can think of and cannot get this option to work.
This is the error I receive:
Error in line 76 of script : TypeError. 'rmdir' undefined or not a function
I've tried:
Dir.rmdir(variableName);
rmdir(variableName);
variableName.rmdir();
Dir.variableName.rmdir();
Can anyone point me in the right direction on this?
Thanks.
William Buckingham
Anyone have the correct syntax to remove a directory…?
Anyone have the correct syntax to remove a directory…?
Regards,
William Buckingham
William Buckingham
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Anyone have the correct syntax to remove a directory…?
Try
var theDir = new Dir(variableName);
theDir.rmdir();
or
var theDir = new Dir(variableName);
theDir.rmdirs();
The 2nd version will delete subdirectories (and files) if present.
Neither rmdir(dirName) and rmdirs(dirName) are NOT static members for some reason. I've reported the problem previously to Enfocus.
var theDir = new Dir(variableName);
theDir.rmdir();
or
var theDir = new Dir(variableName);
theDir.rmdirs();
The 2nd version will delete subdirectories (and files) if present.
Neither rmdir(dirName) and rmdirs(dirName) are NOT static members for some reason. I've reported the problem previously to Enfocus.
Anyone have the correct syntax to remove a directory…?
Hi Dwight
Thanks for the response and I can report your 2nd option works.
I had declared the variableName in the exact same way as your syntax outside the if/else block that does the removal, but setting it inside the conditional block with your syntax sorted it out.
Thanks again.
William Buckingham
Thanks for the response and I can report your 2nd option works.
I had declared the variableName in the exact same way as your syntax outside the if/else block that does the removal, but setting it inside the conditional block with your syntax sorted it out.
Thanks again.
William Buckingham
Regards,
William Buckingham
William Buckingham
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Anyone have the correct syntax to remove a directory…?
Buck, my guess why rmdir() didn't work is there was a file in the directory, possibly hidden.