[Tutor] symlinking dirs with spaces

Steven D'Aprano steve at pearwood.info
Mon Apr 29 03:12:29 CEST 2013


On 29/04/13 10:54, mike wrote:

> Can you elaborate on what you mean regarding the musicDir variable? I have a loadDir which specifies where the symlinks reside but the actual root of the media directory is /opt/data/music and it's organized via directories based on genres which is why I am specifying musicDir instead of loadDir for this function

Your command, in part, looks like this:

linkNew = ['find', '%s' % musicDir, ...]

The first item is "find", the name of the command. The second item takes a variable which is already a string, musicDir, and turns it into a string using '%s' % musicDir. But it's already a string, so that's just double-handling. Instead, write this:

linkNew = ['find', musicDir, ...]



-- 
Steven


More information about the Tutor mailing list