++ pwd
+ cwd=/media/sf_Lxshare
+ echo Delete files whether they exist or not
Delete files whether they exist or not
+ rm /media/sf_Lxshare/contest/file1 /media/sf_Lxshare/contest/file2
+ echo Delete directory whether it exists or not
Delete directory whether it exists or not
+ rmdir /media/sf_Lxshare/contest
+ echo list directory to ensure it is gone
list directory to ensure it is gone
+ ls -la /media/sf_Lxshare/contest
ls: cannot access '/media/sf_Lxshare/contest': No such file or directory
+ echo Make directory and create 2 files there
Make directory and create 2 files there
+ mkdir /media/sf_Lxshare/contest
+ chmod 777 /media/sf_Lxshare/contest
+ touch /media/sf_Lxshare/contest/file1
+ touch /media/sf_Lxshare/contest/file2
+ chmod 777 /media/sf_Lxshare/contest/file1 /media/sf_Lxshare/contest/file2
+ echo Now try to remove files and dir with python program
Now try to remove files and dir with python program
+ python3 testosfnc.py
cwd=/media/sf_Lxshare
testosfnc: Removing contest files  with os.remove(/media/sf_Lxshare/contest/*)
testosfnc: /media/sf_Lxshare/contest has no files to remove
testosfnc: Removing contest files  with rm -vf /media/sf_Lxshare/contest/*
rm rspns=CompletedProcess(args=['rm', '-vf', '/media/sf_Lxshare/contest/*'], returncode=0, stdout=b'', stderr=b'')
testosfnc: contest files /media/sf_Lxshare/contest/* removed
testosfnc: Removing contest directory /media/sf_Lxshare/contest
testosfnc: directory /media/sf_Lxshare/contest could not be removed
Traceback (most recent call last):
  File "testosfnc.py", line 37, in <module>
    os.removedirs(zcontest)
  File "/usr/lib/python3.8/os.py", line 241, in removedirs
    rmdir(name)
OSError: [Errno 39] Directory not empty: '/media/sf_Lxshare/contest'
+ echo Now list directory again, should be gone
Now list directory again, should be gone
+ ls -la /media/sf_Lxshare/contest
total 12
drwxrwx--- 1 root vboxsf     0 Aug  7  2022 .
drwxrwx--- 1 root vboxsf 12288 Aug  7  2022 ..
-rwxrwx--- 1 root vboxsf     0 Aug  7 01:00 file1
-rwxrwx--- 1 root vboxsf     0 Aug  7 01:00 file2
