Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make sure that a file is deleted with one command? #866

Closed
Tracked by #1671
plavjanik opened this issue Nov 30, 2020 · 5 comments · Fixed by #2254
Closed
Tracked by #1671

How to make sure that a file is deleted with one command? #866

plavjanik opened this issue Nov 30, 2020 · 5 comments · Fixed by #2254
Assignees
Labels
community-upvoted enhancement New feature or request priority-medium Not functioning - next quarter if capacity permits
Milestone

Comments

@plavjanik
Copy link

I am trying to delete a file that may not exist.

In Linux, I would use rm -f /tmp/may-not-exist and that would either delete it if it is there or not delete without any error message and error code if it is already deleted.

The man page of rm says:

     -f          Attempt to remove the files without prompting for confirmation, regardless of the file's permissions.  If the file does not exist, do not display a
                 diagnostic message or modify the exit status to reflect an error.  

This is a useful option because I do not need to check if the file is deleted before I am deleting and it leads to simple and more stable automation (because the file can be deleted outside of my script after the check).

The Zowe CLI has -f option that has a different meaning. If the file does not exist, Zowe CLI fails with an error.

--for-sure | -f (boolean)

Specify this option to confirm that you want to delete the file or directory permanently.

It would be useful to have a similar option -f as Linux rm has so it returns 0 when the file does not exist.

The current behavior is:
image

@gejohnston gejohnston added enhancement New feature or request priority-low Legit issue but cosmetic or nice-to-have labels Oct 17, 2022
@github-actions
Copy link

Thank you for raising this issue.
The community has 90 days to upvote 👍 the issue.
If it receives 5 upvotes, we will move it to our backlog. If not, we will close it.

@zFernand0 zFernand0 added enhancement New feature or request and removed enhancement New feature or request labels Mar 8, 2023
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

Thank you for raising this enhancement request.
The community has 90 days to vote on it.
If the enhancement receives at least 5 upvotes, it is added to our development backlog.
If it receives fewer votes, the issue is closed.

@zFernand0 zFernand0 added priority-medium Not functioning - next quarter if capacity permits and removed priority-low Legit issue but cosmetic or nice-to-have labels Mar 8, 2023
@zFernand0 zFernand0 mentioned this issue Mar 29, 2023
28 tasks
@adam-wolfe adam-wolfe mentioned this issue May 31, 2023
19 tasks
@adam-wolfe
Copy link
Contributor

We could add an ignore/suppress errors option for delete operations.

@adam-wolfe adam-wolfe mentioned this issue Apr 19, 2024
23 tasks
@JTonda
Copy link

JTonda commented Apr 22, 2024

Implement as new flag and only detect that files not there as a success.

@adam-wolfe
Copy link
Contributor

Suggesting adding a --quiet flag, that attempts the delete and checks that the file does not exist. No errors would be thrown as long as the file is not in place after the attempted delete operation.

This would be for delete ops for DS, USS, zFS, and maybe VSAM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-upvoted enhancement New feature or request priority-medium Not functioning - next quarter if capacity permits
Projects
Status: Closed
6 participants