Jump to content
MaxSat

Delete files with specific extension

Recommended Posts

Hi,

I am trying to create a scrip in Connectwise Automate to delete files from a Downloads folder with specific extension .nupkg. The shell script is running fine locally but not via Automate. Not sure what I am doing wrong.

Script is below:

ForFiles /p "C:\Users\$env:username\Downloads" /s /c "cmd /c del /S *.nupkg"

 

Share this post


Link to post
Share on other sites

The system account profile doesn't live under c:\users. It lives C:\Windows\System32\config\systemprofile
You'll need to enumerate the path in another way.

Share this post


Link to post
Share on other sites

I don't do this much but I think the Console Shell function is what you'd want, to run as the logged in user...?

Edit: or for a one-off, Commands/User's Desktop/Run A Program.

Edited by SteveYates

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...