Notifications
Clear all

[Closed] Dumb question about a unc path begining with \\q?

Edit – found my noob mistake, please ignore!

Heya Folks,

I’m doing a quick path setting utility to set render files and elements according to a shot code structure and I’ve got a quick issue with a string containing a character that max doesn’t like. I’ve got a function to create folders based on a few variables, and in part of it I want to put in some feedback to let the user know if there are existing files in that folder.

My problem is that the name of the drive that the files are going to is qnap2 and thus the base path that files are going out to is

"\\\\qnap2\\vol3\\ldom2\\Shots\\"

in maxscript.

When I set a path it’s as follows:

theOutPath = BasePath + ss_shotNum.text + "\\Output\\3d\\" + ss_shotNum.text + "_" + ss_shotElement.text + "_" + ss_shotVersion.text

Which works fine, and I can make folders correctly. The problem is with the getfiles command here:

		if (isDirectoryWriteable theOutPath == false) then 
 		(
 			
 			print "folder does not exist, lets make one so."
 			makeDir theOutPath
 			
 		) else (
 			
 			theExistingFiles = (getfiles (BasePath + ss_shotNum.text + "\\Output\\3d\\" + ss_shotNum.text + "_" + ss_shotElement.text + "_" + ss_shotVersion.text + "\\*.*")).count
 			
 			if (theExistingFiles > 1) then
 				(					
 					messagebox "There are " + theExistingFiles " files already in this folder, be careful of overwriting!"					
 				)
 			
 		)

I don’t get any feedback from the listener, even though there is a file in the directory as a test. If I use this command in the listener:

getfiles "\\\\qnap2\\vol3\\ldom2\\Shots\\001_1016\\Output\\3d\\001_1016_rover_004\\*.*"

it correctly returns the name of the file I’ve placed in the folder but it seems when I dynamically generate the above path it works fine for making folders but not for checking their contents.

Anyone any thoughts about what noob mistake I’m making on it?

4 Replies

If you don’t use the @ symbol before path strings you’re going to have a bad time.

Ooh, interesting! What’s the purpose of it and what category would it come in under in the help docs so I can look further into it?

Cheers for the pointer!

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=files/GUID-7F17449E-C377-445C-AC15-CD3BA88A975B.htm,topicNumber=d30e141051

String Literals, you can find it by searching for “verbatim”.
It was added in Max 2008, so instead of saying
a = “\\something\ est”
you can say
a = @”\something est”
A string behind @ will be taken verbatim, “as is” without the need for escape characters.
Not sure if it will solve your problem though.

Also note that the line

messagebox "There are " + theExistingFiles " files already in this folder, be careful of overwriting!"

should be

messagebox ("There are " + theExistingFiles as string + " files already in this folder, be careful of overwriting!")

but I am sure you know that…

Ah – Good to know and I’ll stick that in! It might also help with some uppercase / Lowercase stuff I’m getting.

And cheers for the bracketing – I go through bursts of scripting and not, so my standards and basics vary wildly. Good to have a guardian angel