Post by mknarr on Aug 5, 2018 16:04:58 GMT -5
I found something interesting on the FILES command which I should have know better.
I had code that worked in Windows 7 but not windows 8 or 10 and the problem was the way FILES statement read folders and files. This code worked in Win7 but not in win 8 or 10.
flag2=0 'Set to 1 if the backup folder exists on the destination drive
files BDName$, info$() 'This would get the folder name which might look like C20180805All Data in info$
for x=1 to val(info$(0,1)) 'Number of folders on backup destination.
'HDPath$+BackupFolder$+BkupMaskName$ would equal C20180805All Data
if HDPath$+BackupFolder$+BkupMaskName$=info$(x,1) then 'Did this folder exist.
flag2=1 'Backup folder exists on destination drive.
exit for
end if
next
On win 7 it would find the folder as a file but not on win 8 or 10So I had to change the code to look like this
flag2=0 'Set to 1 if the backup folder exists on the destination drive
files BDName$, info$() 'Get folder info on backup destination.
numfiles=val(info$(0,0)) 'find the number of files
numfolders=val(info$(0,1)) 'then find the number of folders
for x=numfiles+1 to numfolders+numfiles
if HDPath$+BackupFolder$+BkupMaskName$=info$(x,1) then 'Does the backup folder exist on backup destination?
flag2 =1 'set to 1 because the same folder exist
end if
if flag2=1hen exit for
end if
next
In retrospect I now realize e the first code should not have worked but did because FILES treated a folder as a file. The second code works in win7 as it should.