Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have this script below, FileSize and FileTime are returning data, but FilePath, FileDir, FileExtension are not returning anything - what is wrong?
sub
DoDir (Root)
for each Ext in 'bmp', 'jpg', 'png', 'tif'
for each File in filelist (Root&'\*.' &Ext)
LOAD
'$(File)' as [Image Name],
FilePath('$(File)') as [Image Path],
FileDir('$(File)') as [Image Dir],
FileExtension('$(File)') as [Image Ext],
FileSize('$(File)') as [Image Size],
FileTime('$(File)') as [Image Time],
Year(Date(FileTime('$(File)'))) as [Year]
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir
end sub
If I look closer on your example I see now that you didn't load from a file else per autogenerate and therefore you couldn't use those file-functions. Instead of them use:
...
'$(File)' as [Image Path],
subfield('$(File)', '.', 2) as [Image Ext],
mid('$(File)', 1, index('$(File)', '\', -1) - 1) as [Image Dir]
...
- Marcus
May be this
sub
DoDir (Root)
for each Ext in 'bmp', 'jpg', 'png', 'tif'
for each File in filelist (Root&'\*.' &$(Ext))
LOAD
'$(File)' as [Image Name],
FilePath('$(File)') as [Image Path],
FileDir('$(File)') as [Image Dir],
FileExtension('$(File)') as [Image Ext],
FileSize('$(File)') as [Image Size],
FileTime('$(File)') as [Image Time],
Year(Date(FileTime('$(File)'))) as [Year]
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir
end sub
You need to use these functions without a parameter like:
filepath() as [Image Path]
Another way to get these informations could be to use string-functions like subfield() or '$(EXT)' for the file-extension.
- Marcus
Marcus,
I tried that first, that doesn't work either.
Regards,
Marty.
If I look closer on your example I see now that you didn't load from a file else per autogenerate and therefore you couldn't use those file-functions. Instead of them use:
...
'$(File)' as [Image Path],
subfield('$(File)', '.', 2) as [Image Ext],
mid('$(File)', 1, index('$(File)', '\', -1) - 1) as [Image Dir]
...
- Marcus
Thanks Marcus ,
But how come the FileSize and FileTime worked?
Regards,
Marty.
No, I meant only those file-functions which didn't work - by filetime() and filesize() you could further use your previous and working approach.
- Marcus