[Tutor] Excluding a directory in a script...
Kent Johnson
kent37 at tds.net
Wed May 7 22:23:26 CEST 2008
On Wed, May 7, 2008 at 3:34 PM, Spencer Parker <inthefridge at gmail.com> wrote:
> I have a script that is just basically looking for a disk image in a
> directory...it lists all the directories in the main disk image directory
> then appends disk.img to the end to build the full file path. I have one
> directory that holds old images in it for deletion at a later date. This
> directory will never contain disk.img in there...it causes the script to
> error out since it didn't find that in there. How can I exclude this
> directory from being listed?
I guess you want something like
path = sys.argv[1] + '/' + i + '/disk.img'
if not os.path.isfile(path):
continue
Kent
PS it helps to give the actual error as well as the code.
More information about the Tutor
mailing list