Hello there! I'm having a lot of trouble writing a script.
The script is supposed to:
1) Find all files with the name "Object.mtl" within each folder in the directory: /Users/username/Desktop/convert/Objects
2) Search and replace the string ".bmp" with ".tif" (without the quotations)
3) Output the file to /Users/username/Desktop/convert/Props/ using the name of the folder the object was found in + .mtl
Example:
Then:
4) Find all files with the name "Object.obj" within each folder in the directory: /Users/username/Desktop/convert/Objects
5) Rename the file to the folder it was found in + .obj
6) Move (or copy it doesn't really matter) to /Users/username/Desktop/convert/Props/
Example:
Please if you could spare any help I would appreciate it! :)
Thank you very much!
By the way:
I used to know some very basic sed/unix programming, but it has all been lost. Here is what I started to do if you would like a good laugh:
The script is supposed to:
1) Find all files with the name "Object.mtl" within each folder in the directory: /Users/username/Desktop/convert/Objects
2) Search and replace the string ".bmp" with ".tif" (without the quotations)
3) Output the file to /Users/username/Desktop/convert/Props/ using the name of the folder the object was found in + .mtl
Example:
Code:
Found: /Users/username/Desktop/convert/Objects/Props00/Object.mtl
(Replace all ".bmp" with ".tif")
Output to: /Users/username/Desktop/convert/Props/Prop00.mtl
Found: /Users/username/Desktop/convert/Objects/Props01/Object.mtl
(Replace all ".bmp" with ".tif")
Output to: /Users/username/Desktop/convert/Props/Prop01.mtl
...And so on
4) Find all files with the name "Object.obj" within each folder in the directory: /Users/username/Desktop/convert/Objects
5) Rename the file to the folder it was found in + .obj
6) Move (or copy it doesn't really matter) to /Users/username/Desktop/convert/Props/
Example:
Code:
Found: /Users/username/Desktop/convert/Objects/Props00/Object.obj
(Rename Object.obj to Props00.obj)
Output to: /Users/username/Desktop/convert/Props/Prop00.obj
Found: /Users/username/Desktop/convert/Objects/Props01/Object.obj
(Rename Object.obj to Props01.obj)
Output to: /Users/username/Desktop/convert/Props/Prop01.obj
...And so on
Thank you very much!
By the way:
I used to know some very basic sed/unix programming, but it has all been lost. Here is what I started to do if you would like a good laugh:
Code:
find /Users/username/Desktop/convert/Objects -name "Object.mtl" -type f -exec sh -c '\
sed 's/.bmp/.tif/g' `dirname {} `/Object.mtl > `dirname {}`/Object2.mtl; \
rm -rf {} \
' \;