Forum Discussion
I3ordo
Mar 05, 2022Copper Contributor
modifying an existing vb script - for moving certain files (list.txt) to a new location.
This script below ' The list of files to copy. Should be a text file with one file on each row. No paths - just file name.
Const strFileList = "\\whitewalker2018\Users\bdogr\Desktop\list.txt"...
I3ordo
Mar 06, 2022Copper Contributor
Anybody can take a glimpse? it just has to move instead of "copy" and i replaced them but it does not work...
- Mar 06, 2022Well.. This is a PowerShell forum and nota VBScript one, perhaps this is something somebody could answer if they have VBScript experience.. But could you share the error messages that you get, perhaps this will give a better view what is failing
- I3ordoMar 07, 2022Copper Contributorthe error messages are preset message like"error copying" , also on powershell.org forums, A user (matt-bloomfield) pointed me at the right direction by writing this.:
"Only had the briefest look at this but the Move() method doesn’t support the overwrite option, so you’d need to remove the overwrite option. If everything else works, then all you should need to do is replace:
objFSO.CopyFile strSourceFilePath, strTargetFilePath, blnOverwrite
with
objFSO.MoveFile strSourceFilePath, strTargetFilePath"
and that really was the problem.
i made the change and it was able to move files instead.
While testing it, i also found out that the script was working on flat folders only. not working recursively, like a robocopy /s so i think i should head to vbscript forums for a recursive modification.