Sample Header Ad - 728x90

Select one out of 2 specific files, copy and rename it

1 vote
0 answers
40 views
I need help running code locally using a terminal app called NewTerm2 on my iPhone (this app has limited functionality but it's more comfortable with unix commands) Here's the case: I have this tree /Library/Themes/"Variable Folder"/Bundles/com.apple.springboard/some images.png (Variable Folder can be any name) Variable Folders might contain several images but the ones I'm interested in are only Image1 or Image2, **to be clear, some could contain only one of these 2** I need to: 1- copy one of the 2 patterns only, "Image1.png" or "Image2.png" 2- rename the copied image "Variable Folder.png" and place it in another location. So I started with this code applying to Image1
/Library/Themes/"Variable Folder"/Bundles/com.apple.springboard
"Image1.png" /var/mobile/Documents/Dock-Temp/"Variable Folder.png"
But it worked only for the Variable folders containing Image1, so I modified it to this:
/Library/Themes/"Variable Folder"/Bundles/com.apple.springboard
. -type f \( -name "Image1.png" -or -name "Image2.png" \) | head -n 1 | sed 's|^./||' | xargs cp /var/mobile/Documents/Dock-Temp/"Variable Folder.png"
head -n 1 gets the first result from find, sed 's|^./||' removes ./ before file name But only the part of code up to xargs works, I'd be grateful if someone helps me find the error
Asked by Tito (73 rep)
May 28, 2021, 01:40 PM