def _process_listdir(self):
     """
     Lists the content of a directory and returns it to the command listener,
     either including or not the file sizes.
     Syntax:
             LISTDIR <size> <path>
             
             size:   Indicates if the returned list should containg the size
                     or not. 0 indicates no, 1 indicates yes.
             path:   The path to the file or folder that will be listed.
     """
     include_size, path = self._args.split(' ', 1)
     include_size = (include_size == '1')
     
     FileUtils.list_dir(path, include_size, self._send_to_listener)
Example #2
0
    def _process_listdir(self):
        """
        Lists the content of a directory and returns it to the command listener,
        either including or not the file sizes.
        Syntax:
                LISTDIR <size> <path>
                
                size:   Indicates if the returned list should containg the size
                        or not. 0 indicates no, 1 indicates yes.
                path:   The path to the file or folder that will be listed.
        """
        include_size, path = self._args.split(' ', 1)
        include_size = (include_size == '1')

        FileUtils.list_dir(path, include_size, self._send_to_listener)
Example #3
0
    def _process_copy_file(self):
        files = self._args.split('>')

        if len(files) < 2:
            raise RuntimeError('Invalid call to the COPY_FILE command')

        src = files[0]
        tgt = files[1]
        tgt_backup = ""
        if len(files) > 2:
            tgt_backup = files[2]

        src.strip()
        tgt.strip()
        tgt_backup.strip()
        FileUtils.copy_file(src, tgt, tgt_backup)
 def _process_copy_file(self):
     files = self._args.split('>')
     
     if len(files) < 2:
         raise RuntimeError('Invalid call to the COPY_FILE command')
     
     src = files[0]
     tgt = files[1]
     tgt_backup = ""
     if len(files) > 2:
         tgt_backup = files[2]
         
     src.strip()
     tgt.strip()
     tgt_backup.strip()
     FileUtils.copy_file(src, tgt, tgt_backup)
Example #5
0
 def _process_remove_directory_recursive(self):
     FileUtils.remove_directory_recursive(self._args)
Example #6
0
 def _process_create_directory_recursive(self):
     FileUtils.create_directory_recursive(self._args)
Example #7
0
 def _process_create_directory(self):
     FileUtils.create_directory(self._args)
Example #8
0
 def _process_check_path_exists(self):
     self._client.send(str(FileUtils.check_path_exists(self._args)))
Example #9
0
 def _process_check_dir_writable(self):
     self._client.send(str(FileUtils.check_dir_writable(self._args)))
Example #10
0
 def _process_get_free_space(self):
     free_space = FileUtils.get_free_space(self._args)
     self._client.send(str(free_space))
 def _process_check_path_exists(self):
     self._client.send(str(FileUtils.check_path_exists(self._args)))
Example #12
0
 def _process_get_file_owner(self):
     self._client.send(str(FileUtils.get_file_owner(self._args)))
 def _process_get_file_owner(self):
     self._client.send(str(FileUtils.get_file_owner(self._args)))
 def _process_delete_file(self):
     FileUtils.delete_file(self._args)
 def _process_remove_directory_recursive(self):
     FileUtils.remove_directory_recursive(self._args)
 def _process_create_directory_recursive(self):
     FileUtils.create_directory_recursive(self._args)
 def _process_create_directory(self):
     FileUtils.create_directory(self._args)
Example #18
0
 def _process_delete_file(self):
     FileUtils.delete_file(self._args)
 def _process_get_free_space(self):
     free_space = FileUtils.get_free_space(self._args)
     self._client.send(str(free_space))
 def _process_check_dir_writable(self):
     self._client.send(str(FileUtils.check_dir_writable(self._args)))
Example #21
0
 def _process_getfile_lines(self):
     #GETFILE_LINES <skip> <path>
     skip, path = self._args.split(' ', 1)
     skip = int(skip)
     FileUtils.get_file_lines(path, skip, self._send_to_listener)
 def _process_getfile_lines(self):
     #GETFILE_LINES <skip> <path>
     skip, path = self._args.split(' ', 1)
     skip = int(skip)
     FileUtils.get_file_lines(path, skip, self._send_to_listener)