820 ) |
820 ) |
821 out, err = self.executeCommands(command, mode=self._submitMode) |
821 out, err = self.executeCommands(command, mode=self._submitMode) |
822 if err: |
822 if err: |
823 raise OSError(self._shortError(err)) |
823 raise OSError(self._shortError(err)) |
824 |
824 |
|
825 def rename(self, oldname, newname): |
|
826 """ |
|
827 Public method to rename a file on the device. |
|
828 |
|
829 @param oldname current name of the file |
|
830 @type str |
|
831 @param newname new name for the file |
|
832 @type str |
|
833 @exception OSError raised to indicate an issue with the device |
|
834 """ |
|
835 if oldname and newname: |
|
836 command = """ |
|
837 import os as __os_ |
|
838 __os_.rename('{0}', '{1}') |
|
839 del __os_ |
|
840 """.format( |
|
841 oldname, newname |
|
842 ) |
|
843 out, err = self.executeCommands(command, mode=self._submitMode) |
|
844 if err: |
|
845 raise OSError(self._shortError(err)) |
|
846 |
825 def put(self, hostFileName, deviceFileName=None): |
847 def put(self, hostFileName, deviceFileName=None): |
826 """ |
848 """ |
827 Public method to copy a local file to the connected device. |
849 Public method to copy a local file to the connected device. |
828 |
850 |
829 @param hostFileName name of the file to be copied |
851 @param hostFileName name of the file to be copied |