[Tutor] symlinking dirs with spaces
mike
mike at froward.org
Mon Apr 29 02:54:10 CEST 2013
On 04/28/2013 07:37 PM, Dave Angel wrote:
> 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.
>
>
I separated the maxdepth argument with '-maxdepth', '2', seems and now
it is focusing on the exec portion which i'm trying to figure out how to
separate and make it sane as far as single/double quotes go.
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
More information about the Tutor
mailing list