[Tutor] symlinking dirs with spaces

mike mike at froward.org
Mon Apr 29 04:00:05 CEST 2013


On 04/28/2013 08:12 PM, Steven D'Aprano wrote:
> 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, ...]
>
>
>


Ahhh I see the redundancy now, the function seems satisfied with the 
linkNew list with the exception of how how I'm using '-exec ...'

I get the following when executing:

rev at sheridan:~/code$ ./addsync pushnew
Enter the duration of time in days you want to link
-5
find: missing argument to `-exec'
rev at sheridan:~/code$

this is the currently working list:

     linkNew = ['find', 'musicDir', '-maxdepth', '2', '-mtime', '%s' % 
durFind, '-not', '-name', '%s' % fileExcl, '-exec', 'addsync {} \;']


Is this an example where I want to be calling this while emulating a shell?



More information about the Tutor mailing list