Hi All,
hope everyone is well? and staying relaxed over the holidays?
All i am a bit stuck trying to write my first python script.
Seeking some advise from the python legends.
Objective: To search a folder with thousands of sub directories, where filenames might contain DVDRip, RIP, and or R5, with file extension of either avi, mkv.
I have working script code if i am only searching for one potential filename includes on of DVDRip, RIP, and or R5, but have to run each separately.
My code is:
import os
import glob
for f in glob.glob('/mnt/folder/Movies/**/*DVD*', '/mnt/folder/Movies/**/*R5*', recursive=True):
print(f)
I thought that if i added an extra comma and another potential name contains it might work. However I get an error i think its is because i am trying to pass to many potential variables where only one can be stated.
Traceback (most recent call last):
File "/home/flapper/py-scripts/test-media-search", line 3, in <module>
for f in glob.glob('/mnt/folder/Movies/**/*R5*', '/mnt/folder/Movies/**/*dvd*', recursive=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: glob() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
Would i need to use maybe definining the potential filenames? and or glob.globs rather than glob.glob?
You help would be really appreciated.
hope everyone is well? and staying relaxed over the holidays?
All i am a bit stuck trying to write my first python script.
Seeking some advise from the python legends.
Objective: To search a folder with thousands of sub directories, where filenames might contain DVDRip, RIP, and or R5, with file extension of either avi, mkv.
I have working script code if i am only searching for one potential filename includes on of DVDRip, RIP, and or R5, but have to run each separately.
My code is:
import os
import glob
for f in glob.glob('/mnt/folder/Movies/**/*DVD*', '/mnt/folder/Movies/**/*R5*', recursive=True):
print(f)
I thought that if i added an extra comma and another potential name contains it might work. However I get an error i think its is because i am trying to pass to many potential variables where only one can be stated.
Traceback (most recent call last):
File "/home/flapper/py-scripts/test-media-search", line 3, in <module>
for f in glob.glob('/mnt/folder/Movies/**/*R5*', '/mnt/folder/Movies/**/*dvd*', recursive=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: glob() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
Would i need to use maybe definining the potential filenames? and or glob.globs rather than glob.glob?
You help would be really appreciated.