File Deletion fails

I am trying to delete a set of txt files located in a certain directory by writing a cmd file (removeFiles.cmd). The cmd file gets all the txt files to be deleted in a directory leaving the most recent file alone using now - modification time of it statement but the i get exit code 1.
When i go to run the created cmd file in a command window on it’s own i get the error “the system cannot find the file Specified” and the directory and files are verified to be there.

This is the action script that is being executed

action uses wow64 redirection false
delete __appendfile

appendfile {concatenation “%0d%0a” of (“del /q %22” & it & “%22”) of pathnames of find files ("*.txt") whose (now - modification time of it > 1 * day) of (it; descendant folders of it) of folders (“C:\ProgramData\Qualcomm® Snapdragon™ X55 5G Modem\SVCLog”)}

delete RemoveFiles.cmd
move __appendfile RemoveFiles.cmd
waithidden cmd /c RemoveFiles.cmd

The cmd file looks like this once it’s has been created

del /q "C:\ProgramData\Qualcomm® Snapdragon™ X55 5G Modem\SVCLog\Test.txt"
del /q “C:\ProgramData\Qualcomm® Snapdragon™ X55 5G Modem\SVCLog\Test1.txt”

This is the output from running RemoveFiles.cmd in a command window

C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__FixletDebugger>del /q "C:\ProgramData\Qualcomm« SnapdragonÖ X55 5G Modem\SVCLog\Test.txt"
The system cannot find the path specified.

C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__FixletDebugger>del /q "C:\ProgramData\Qualcomm« SnapdragonÖ X55 5G Modem\SVCLog\Test1.txt"
The system cannot find the path specified.

Any help would be greatly appreciated, Thanks

It’s very likely a problem with the special unicode characters in the path for “®” and “™”. I’m not sure how to make the cmd shell respect the characters.

The key is going to be for you to figure out how to build the batch file correctly (outside of BigFix). Probably using the command prompt to start with and run some of the delete commands manually.

You could try using the 8.3 short names for the folders in question, assuming that capability hasn’t been disabled on your server. PowerShell scripting would be useful for this.

This is an approach I’ve used to delete multiple file which seems to work with unicode. I used a makeshift relevance to pull filenames to test for your type of situation so use relevance as best fits your use case. I used “run cmd.exe /k” just for testing in the debugger, for the fixlet action use I’d use “waithidden cmd.exe /c” instead.

parameter "Files2Delete" = "{"%22" & (concatenation "%22 %22" of (pathnames of descendants whose (name of it as lowercase starts with "myfile") of folders whose (name of it as lowercase starts with "qualcomm") of folder "C:\TEMP\")) & "%22"}"
run cmd.exe /k "for %a in ({parameter "Files2Delete"}) do del %a"

From the action output from the debugger