0

Ubuntu 20.04.1; Mate desktop

Is there an app I can install or already have that will 'wipe' just one directory on the drive? Or will a 'Cut' operation, then dropping the file(s) into removable media, completely erase those files?

Or is there a command that will do it in Term? As Root?

Thanks.

Jim_HiTek
  • 291

1 Answers1

0

I think that the mv ( or move command ) would work.

  1. I'll create a test directory in my current directory.

    steve@AntHill2:~$ mkdir testdir
    
  2. Next I will throw a few random files into it.

    steve@AntHill2:~$ cp -p *.pdf  testdir
    
  3. Then verify that the files are present with the ls command

    steve@AntHill2:~$ ls testdir
    AWOJOBI-DISSERTATION-2020.pdf  
    R43215_2018Oct23.pdf  R45415_2018Nov28.pdf
    IF11029_2018Nov27.pdf          
    R45393_2018Nov02.pdf  RS20871_2018Nov28.pdf
    LSB10217_2018Nov15.pdf         
    R45394_2018Nov05.pdf
    
  4. Next I will move the directory including its files to the attached and mounted flash drive.

    steve@AntHill2:~$ mv testdir /media/steve/Backup
    
  5. To prove that the directory has been wiped off, I will try an ls command.

    steve@AntHill2:~$ ls -artl testdir
    ls: cannot access 'testdir': No such file or directory
    
  6. To show that the files are now on my removable drive.

    steve@AntHill2:~$ ls -artl /media/steve/Backup/testdir
    total 10504
    -rw-rw-r--  1 steve steve 2179135 Feb 22 23:13 AWOJOBI-DISSERTATION-2020.pdf
    -rw-rw-r--  1 steve steve  370498 Feb 22 23:20 IF11029_2018Nov27.pdf
    -rw-rw-r--  1 steve steve 1973673 Feb 22 23:22 RS20871_2018Nov28.pdf
    -rw-rw-r--  1 steve steve 1237639 Feb 22 23:23 R45394_2018Nov05.pdf
    -rw-rw-r--  1 steve steve 1805083 Feb 22 23:25 R45415_2018Nov28.pdf
    -rw-rw-r--  1 steve steve  570959 Feb 22 23:27 LSB10217_2018Nov15.pdf
    -rw-rw-r--  1 steve steve 1117265 Feb 22 23:29 R43215_2018Oct23.pdf
    -rw-rw-r--  1 steve steve 1416249 Feb 22 23:30 R45393_2018Nov02.pdf
    drwxrwxr-x  2 steve steve    4096 Mar 11 22:30 .
    drwxrwxrwt 22 root  root    61440 Mar 11 22:31 ..
    
  • I hope you can use this or something similar.

  • Though these are simple directory examples, the mv command can move complicated structures having subdirectories and files beneath them by moving the top directory name.

muru
  • 207,228
mondotofu
  • 817
  • 6
  • 12