Operation not permitted error when deleting as root

237

Solution 1

The directory RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003 is presumably read-only. Run chmod -R u+w RECYCLER to set write permission on directories, then rm -rf RECYCLER.

If this is through a FUSE filesystem, it's possible that only the user who mounted the filesystem has write permission on it. In that case, run su user rm -rf RECYCLER.

Solution 2

This is due to an immutable attribute set for the files. If your filesystem driver allows it, run the command below before removing it.

chattr -i RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/*
rm -f RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/*
Share:
237

Related videos on Youtube

Leonard Febrianto
Author by

Leonard Febrianto

Updated on September 18, 2022

Comments

  • Leonard Febrianto
    Leonard Febrianto almost 2 years

    I want to get TextView value from adapter and change it.

    I have Button inside Adapter, and when i press that button, i want to change TextView value from inside adapter. Is that possible ?

    Here is my adapter :

    public class CustomGridView3 extends BaseAdapter {
        private ArrayList<ListItem> listData = new ArrayList<ListItem>();
        private LayoutInflater layoutInflater;
        private Context context;
        private int count = 0;
        CustomGridView3 adapter = this;
        int hargax,qtyx,totalx;
        public CustomGridView3(Context context, ArrayList<ListItem> listData) {
            this.listData = listData;
            layoutInflater = LayoutInflater.from(context);
            this.context = context;
        }
    
        @Override
        public int getCount() {
            return listData.size();
        }
    
        @Override
        public Object getItem(int position) {
            return listData.get(position);
        }
    
        @Override
        public long getItemId(int position) {
            return position;
        }
    
        public View getView(final int position, View convertView, ViewGroup parent) {
            final ViewHolder holder;
            if (convertView == null) {
                convertView = layoutInflater.inflate(R.layout.afterlogin_product_gridview, null);
                holder = new ViewHolder();
                holder.headlineView = (TextView) convertView.findViewById(R.id.nama_produk);
                holder.teaserView = (TextView) convertView.findViewById(R.id.harga);
                holder.imageView = (ImageView) convertView.findViewById(R.id.img_produk);
                holder.cmdMinus = (Button) convertView.findViewById(R.id.btn_min);
                holder.cmdPlus = (Button) convertView.findViewById(R.id.btn_plus);
                holder.qty = (TextView) convertView.findViewById(R.id.lbl_qty);
                holder.layout1 = (LinearLayout) convertView.findViewById(R.id.layout1);
                holder.harga = (TextView) convertView.findViewById(R.id.harga);
                holder.satuan = (TextView) convertView.findViewById(R.id.satuan);
                convertView.setTag(holder);
    
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
    
    
    
            final ListItem newsItem = listData.get(position);
            String satuan = newsItem.getSatuan().toString();
            String harga = newsItem.getReporterName().toString();
            harga = "Rp. " + harga + " / " + satuan;
            holder.headlineView.setText(newsItem.getHeadline().toUpperCase());
            holder.teaserView.setText(harga);
    
            SharedPreferences pref = context.getSharedPreferences("MyPref", 0); // 0 - for private mode
            Integer qtys = Integer.parseInt(pref.getString(newsItem.getHeadline() + "_003", "0"));
            newsItem.setQuantity(qtys);
            holder.qty.setText(String.valueOf(newsItem.getQuantity()));
            String a = newsItem.getUrl();
    
            holder.cmdMinus.setTag(position);
            holder.cmdPlus.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    count = newsItem.getQuantity();
                    count++;
                    newsItem.setQuantity(count);
                    holder.qty.setText("" + count);
                    SharedPreferences pref = context.getSharedPreferences("MyPref", 0); // 0 - for private mode
                    SharedPreferences.Editor editor = pref.edit();
                    editor.putString(newsItem.getHeadline() + "_001", newsItem.getReporterName()); // harga
                    editor.putString(newsItem.getHeadline() + "_002", newsItem.getHeadline());  //nama
                    editor.putString(newsItem.getHeadline() + "_003", String.valueOf(count));  //quantity
                    editor.putString(newsItem.getHeadline() + "_004", newsItem.getSatuan());  //satuan
                    editor.putString(newsItem.getHeadline() + "_005", newsItem.getUrl());  //url
                    editor.commit();
                }
            });
    
            holder.cmdMinus.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    count = newsItem.getQuantity();
                    count--;
                        newsItem.setQuantity(count);
                        holder.qty.setText("" + count);
                        SharedPreferences pref = context.getSharedPreferences("MyPref", 0); // 0 - for private mode
                        SharedPreferences.Editor editor = pref.edit();
                        editor.putString(newsItem.getHeadline() + "_001", newsItem.getReporterName()); // harga
                        editor.putString(newsItem.getHeadline() + "_002", newsItem.getHeadline());  //nama
                        editor.putString(newsItem.getHeadline() + "_003", String.valueOf(count));  //quantity
                        editor.putString(newsItem.getHeadline() + "_004", newsItem.getSatuan());  //satuan
                        editor.putString(newsItem.getHeadline() + "_005", newsItem.getUrl());  //url
                        editor.commit();
    
                        if(count == 0)
                        {
                            SharedPreferences prefs = context.getSharedPreferences("MyPref", 0); // 0 - for private mode
                            SharedPreferences.Editor editors = prefs.edit();
                            editors.remove(newsItem.getHeadline() + "_001");
                            editors.remove(newsItem.getHeadline() + "_002");
                            editors.remove(newsItem.getHeadline() + "_003");
                            editors.remove(newsItem.getHeadline() + "_004");
                            editors.remove(newsItem.getHeadline() + "_005");
                            editors.commit();
                            listData.remove(position);
                            adapter.notifyDataSetChanged();
                        }
                }
            });
    
            holder.qty.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    
                }
    
                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                    hargax = Integer.parseInt(newsItem.getReporterName());
                    qtyx = newsItem.getQuantity();
                    hargax = hargax * qtyx;
                    if (context instanceof AfterLogin_Cart)
                    {
                        ((AfterLogin_Cart)context).getPrice();
                    }
                }
    
                @Override
                public void afterTextChanged(Editable s) {
                ***** Change TextView from Parent Activity *******
                }
            });
    
            if (holder.imageView != null) {
                //new ImageDownloaderTask(holder.imageView).execute(newsItem.getUrl());
                Picasso
                        .with(context)
                        .load(a)
                        .fit()
                        .noFade()
                        .into(holder.imageView);
            }
    
            return convertView;
        }
    
        static class ViewHolder {
            TextView headlineView;
            TextView teaserView;
            ImageView imageView;
            TextView qty;
            Button cmdPlus,cmdMinus;
            LinearLayout layout1;
            TextView harga,satuan;
        }
    

    From addTextChangeListener, i want to change TextView value from parent's activity. What i have already searching for is just to execute some method.

     if (context instanceof AfterLogin_Cart)
     {
        ((AfterLogin_Cart)context).getPrice();
     }
    
    • Admin
      Admin over 12 years
      What is the drive mounted as?
    • Admin
      Admin over 12 years
      Its automounted in /media as with NTFS as the FS
    • Eliran Tutia
      Eliran Tutia about 8 years
      You can create the adapter as an Inner Class in you Activity Class, and there you can reach easily the Textview and change it.
    • x0r
      x0r about 8 years
      you can have TextWatcher as a variable in your adapter. Then upon adapter creation you pass this parameter from activity, which implements TextWatcher. And finally inside adapter you just delegate required methods to the TextWatcher instance
    • Leonard Febrianto
      Leonard Febrianto about 8 years
      @EliranTutia I will try it
    • Leonard Febrianto
      Leonard Febrianto about 8 years
      @R.Kirill Could you show how the code is ? Im stilld don't get it
    • x0r
      x0r about 8 years
      @LeonardFebrianto added
  • user61954
    user61954 over 12 years
    Sorry, I dont have windows
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 12 years
    @user61954 NTFS is usually provided through FUSE (via ntfs-3g) these days, so try su user … (second paragraph of my answer).
  • netvope
    netvope over 12 years
    If it's not going to be used on Windows again, I suggest you backup the useful files and reformat it with ext4 or other Linux-native filesystems.
  • user61954
    user61954 over 12 years
    The probelem is that its owner uses Windows :D
  • user61954
    user61954 over 12 years
    Installed ntfs-3g and now it works fine :)
  • Scott - Слава Україні
    Scott - Слава Україні almost 10 years
    @warren: What question does this not answer? The original question does not really ask a question. Implicitly, it asks, "How do I remove contents from a Windows disk?" Dubious is (somewhat anecdotally) answering, "Put the disk back on a Windows system and do it there." It's no less of an answer than Daniel's first answer. OK, yes, user61954 says that [s]he doesn't have Windows; hence Dubious's disclaimer that he hopes this will help someone else.
  • David Yates
    David Yates almost 10 years
    @Scott - the question is about external hard drives and linux: Dubious' answer is about an SD card from an Android device that needed to be deleted using Windows. The answer has nothing to do with the question, and is barely tangentially similar.
  • Penghe Geng
    Penghe Geng about 3 years
    Works on Ubuntu 18.04