[Closed] read files from a folder
I want to compare filenames from a folder with those from the scene! I have a list of textures in 3dmax and I want to scan the folder to detect are there such filenames or not!
let’s say I have scenefiles(just name+extention: 001.jpg), and folderfiles(path+name+extension):
\S003\all\3d\maps\maps\001.jpg!
Question: how to get the name+extension from path+name+extension if the files were read from the folder
local folderfiles=#()
files = getFiles (BitmapLister.bCPathEditText.text + "*.*")
for m in files do
append folderfiles (getFilenameFile m.filename + getFilenameType m.filename)
print folderfiles
for f in scenefiles where (finditem folderfiles f!=0) do
print f
I get this error:
– Unknown property: “filename” in “\S003\all\3d\maps\maps\11_10_1_b.jpg” <<
“\S003\all\3d\maps\maps\0011_b.jpg”
“\S003\all\3d\maps\maps\0011_d.jpg”
“\S003\all\3d\maps\maps\0011_r.jpg”
…
while
the list that I have contains only
“0011_b.jpg”
“0011_d.jpg”
“0011_r.jpg”
…
it means the function returns strings… can a string have #filename property?
but how then should I read files from folder? Or should operate with strings here and not using filename property?
horosh tupit! how can you use #filename property of a value if it doesn’t have it?
I think he is not even read the manual about maxscript…
@try2script : I hope you have a time a while to looking up the maxscript manual. YOu can download it now on autodesk.
I was just thinking, may be there is another way of reading files from a folder, I mean not taking strings but bitmap properties! Anyway, I was wrong!
I thought to do like that then
for f in scenefiles where (findstring folderfiles f==undefined) do
print f
Sorry again!