jssrecording 3 Posted August 31, 2016 Report Share Posted August 31, 2016 Okay so I have my script moving the 2 CSV files from the Download folder to Desktop. After I run my Batch command it merges the 2 files. Where I'm stuck is I need to delete the %OriginalFiles now living on the Desktop but leave the new CSV alone. Here is the part of my code that works. Cheers Jason clear list(%OriginalFiles)wait(2)set(#DownloadFolder,$replace($special folder("Desktop"),"Desktop","Downloads"),"Global")wait(2)add list to list(%OriginalFiles,$get files(#DownloadFolder,"Yes"),"Delete","Global")wait(2)set list position(%OriginalFiles,1)wait(2)loop(2) { move file($next list item(%OriginalFiles),$special folder("Desktop"))}wait(2)shell("cmd /c \"{$special folder("Desktop")}\\csv maker\\makecsvnodup.bat\"") Quote Link to post Share on other sites
pash 504 Posted August 31, 2016 Report Share Posted August 31, 2016 try clear list(%OriginalFiles) set(#DownloadFolder,$replace($special folder("Desktop"),"Desktop","Downloads"),"Global") add list to list(%OriginalFiles,$get files(#DownloadFolder,"Yes"),"Delete","Global") set list position(%OriginalFiles,0) loop($list total(%OriginalFiles)) { set(#File,$next list item(%OriginalFiles),"Global") if($ends with($change text casing(#File,"Lower Case"),".csv")) { then { move file(#File,$special folder("Desktop")) } else { } } } shell("cmd /c \"{$special folder("Desktop")}\\csv maker\\makecsvnodup.bat\"") Quote Link to post Share on other sites
pash 504 Posted August 31, 2016 Report Share Posted August 31, 2016 V2 clear list(%OriginalFiles) set(#DownloadFolder,$replace($special folder("Desktop"),"Desktop","Downloads"),"Global") add list to list(%OriginalFiles,$get files(#DownloadFolder,"Yes"),"Delete","Global") set list position(%OriginalFiles,0) loop($list total(%OriginalFiles)) { set(#File,$next list item(%OriginalFiles),"Global") if($ends with($change text casing(#File,"Lower Case"),".csv")) { then { set(#DesktopFile,$replace(#File,#DownloadFolder,$special folder("Desktop")),"Global") if($file exists(#DesktopFile)) { then { delete file(#DesktopFile) } } move file(#File,$special folder("Desktop")) } else { } } } Quote Link to post Share on other sites
jssrecording 3 Posted August 31, 2016 Author Report Share Posted August 31, 2016 Pash, I don't know what I would do with out you! I'm going to try these options in the morning. Cheers Jason Quote Link to post Share on other sites
jssrecording 3 Posted August 31, 2016 Author Report Share Posted August 31, 2016 Never mind I couldn't sleep lol! I tried both of the versions. None of them are moving the files to the desktop like my original script did. The files have upper and lowercase characters and numbers for the file names. Example: 8c4bS020160830211541.csv Quote Link to post Share on other sites
Brutal 164 Posted September 1, 2016 Report Share Posted September 1, 2016 js - is there a reason you don't just have your combined files save somewhere else so that after each run you can just clear the old ones from the desktop? Quote Link to post Share on other sites
jssrecording 3 Posted September 1, 2016 Author Report Share Posted September 1, 2016 Hey Brutal, the reason is the client has other bots that work off the desktop with the combined CSV file. I'm still trying to figure this last stage out. Thanks for the thought, I would do it your way if possible. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.