I have several folders in the same folder (named ’ Moving’, that’s with a leading space) as this procedure. In the following code,
; Loop through files in this folder looparray FileNames, cr(), FileFolderName ; Loop through strings in text file looparray TagsArray,cr(),StringName if FileFolderName contains StringName filerename FileFolderName, strip(replace(FileFolderName,StringName,"")) endif endloop endloop
FileNames contains a list of the folders and TagsArray contains a list of strings which I want removed from the folder names. The
filerename statement successfully removes the first string from the first folder name and then stops with this error message:
FileRename error: “Sketchbook 03 (of 05) (2021) (Digital)” couldn’t be moved to “ Moving” because either the former doesn’t exist, or the folder containing the latter doesn’t exist.
If I put an
if error trap after the
filerename, the procedure removes one string from each of the folder names and then stops without an error message. Each subsequent run of the procedure removes another string from each folder.
The leading space in the file name is not a factor. Specifying the full path name in each parameter makes no difference.
Am I doing something wrong or is this a bug?