@fardaThis is a sample script for deleting two directories (and any subdirectories they may contain) and two files. Please use this as an example and add to it as required -
[main]
Title=Farda request
Description=
Selected=True
Level=3
Author=Misty
Version=1
Date=2014-04-24
[process]
If,%Method%,Equal,inject,Begin
echo,"Clearing read-only attributes from boot.wim"
ShellExecute,Hide,"attrib.exe","-r #$q%Outputdir%\Sources\boot.wim#$q"
//remove directory \Windows\winsxs\backup (note the use of --recursive for a directory)
ShellExecute,Hide,"%Tools%\wimlib\wimlib-imagex.exe","update #$q%OutputDir%\sources\boot.wim#$q %Boot.wim.Image.number% --command=#$qdelete '\Windows\winsxs\Backup' --recursive#$q"
//remove directory \Windows\System32\cs-CZ (note the use of --recursive for a directory)
ShellExecute,Hide,"%Tools%\wimlib\wimlib-imagex.exe","update #$q%OutputDir%\sources\boot.wim#$q %Boot.wim.Image.number% --command=#$qdelete '\Windows\System32\cs-CZ' --recursive#$q"
//remove file \Windows\winsxs\FileMaps\$$_boot_pcat_fi-fi_da1fe77a29be0007.cdf-ms (note the use of --force which is used just in case the file doesn't exist)
ShellExecute,Hide,"%Tools%\wimlib\wimlib-imagex.exe","update #$q%OutputDir%\sources\boot.wim#$q %Boot.wim.Image.number% --command=#$qdelete '\Windows\winsxs\FileMaps\$$_boot_pcat_fi-fi_da1fe77a29be0007.cdf-ms' --force#$q"
//remove file \Windows\System32\C_037.NLS (note the use of --force which is used just in case the file doesn't exist)
ShellExecute,Hide,"%Tools%\wimlib\wimlib-imagex.exe","update #$q%OutputDir%\sources\boot.wim#$q %Boot.wim.Image.number% --command=#$qdelete '\Windows\System32\C_037.NLS' --force#$q"
End
An alternative method would be to use a file list (in this case
\Projects\Cache\Programs\Misc\WimLibDeleteList.txt). In the following example I have used the command
ShellExecute,Open,"cmd.exe","/K. This will display feedback from the delete commands and can be useful for troubleshooting.
[Process]
If,%Method%,Equal,inject,Begin
echo,"Clearing read-only attributes from boot.wim"
ShellExecute,Hide,"attrib.exe","-r #$q%Outputdir%\Sources\boot.wim#$q"
ShellExecute,Open,"cmd.exe","/K #$q#$q%TOOLS%\wimlib\wimlib-imagex.exe#$q update #$q%OutputDir%\sources\boot.wim#$q %Boot.wim.Image.number% < #$q%Cache%\Programs\Misc\WimLibDeleteList.txt#$q"
End
Contents of
\Projects\Cache\Programs\Misc\WimLibDeleteList.txt -
delete '\Windows\winsxs\Backup' --recursive
delete '\Windows\System32\cs-CZ' --recursive
delete '\Windows\winsxs\FileMaps\$$_boot_pcat_fi-fi_da1fe77a29be0007.cdf-ms' --force
delete '\Windows\System32\C_037.NLS' --force
When you are happy with it, you can always change this section to hide the wimlib process (also ensuring that the cmd.exe switch is changed from /K to /C) -
[Process]
If,%Method%,Equal,inject,Begin
echo,"Clearing read-only attributes from boot.wim"
ShellExecute,Hide,"attrib.exe","-r #$q%Outputdir%\Sources\boot.wim#$q"
ShellExecute,Hide,"cmd.exe","/C #$q#$q%TOOLS%\wimlib\wimlib-imagex.exe#$q update #$q%OutputDir%\sources\boot.wim#$q %Boot.wim.Image.number% < #$q%Cache%\Programs\Misc\WimLibDeleteList.txt#$q"
End
Please note that these script examples will only work if you are building with the INJECT method. If you are using EXTRACT then let me know and I'll put some other instructions together for you.
Regards,
Misty