[Tutor] symlinking dirs with spaces

Dave Angel davea at davea.name
Mon Apr 29 02:37:33 CEST 2013


On 04/28/2013 08:17 PM, mike wrote:
>
>>     <SNIP>
>>>
>
> def sync_new():
>      durFind = raw_input("Enter the duration of time in days you want to
> link")
>      durFind = int(durFind)
>      fileExcl = "*torrent*"
>      linkNew = ['find', '%s' % musicDir, '-maxdepth 2', '-mtime %s' %
> durFind, '-not', '-name', '%s' % fileExcl, '-exec addsync {} \;']
>      subprocess.call(linkNew)
>
        <SNIP>
>
> Running the script with the pushnew argument results in the following
> error from find:
>
> find: unknown predicate `-maxdepth 2'
>
> I'm thinking this is also related to my usage of subprocess? I just
> started carving this out right now so I'm still debugging but if anyone
> sees anything obvious I would appreciate it.
>

Your linkNew list doesn't have separate items for each argument to find. 
  The first example is that "-maxdepth" and "2" should be separate list 
items.  The only other spot I notice is the -exec item, which should be 
distinct from the following.

I don't understand why you have things like '%s' % musicDir, when 
musicDir is already a string.  That list item should be just musicDir, 
which would read much better.


-- 
DaveA


More information about the Tutor mailing list