Delete Linux directories recursively

Can somebody please help to Delete Linux directories recursively.

I am trying to delete contents of a directory which has both files and sub-directories

wait/run rm -rf /path/to/directory/* is not working

How about
wait /bin/sh -c 'rm -rf /path/to/directory'

1 Like

I think folder delete action script command does that.
Please refer to: https://developer.bigfix.com/action-script/reference/file/folder-delete.html

1 Like

As @akira mentioned the best way is folder delete but if you use the shell remember the path can’t have spaces unless it is quoted or escaped

1 Like

I always do this one when I am outside of bigfix…

rm -fdrv /path/to\ directory\ with\ spaces/in/name

Chris

Something to think about w/ bigfix: recursivity is handled by relevance and task building options (in a very novel way I might add). So build the basic task, but then in your deployment window, tell bf to keep retrying until no longer relevant. Make sense?

  1. To remove the folder with all its contents(including all interior folders):
    rm -rf /path/to/directory

  2. To remove all the contents of the folder(including all interior folders) but not the folder itself:
    rm -rf /path/to/directory/* orrm -rf /path/to/directory/{,.}

if you want to make sure that hidden files/directories are also removed.

  1. To remove all the “files” from inside a folder(not removing interior folders):

rm -f /path/to/directory/{,.}

  1. To remove a single file:

rm /path/to/directory/filename

hope this will help you

Thaank You