New call-to-action
Results 1 to 7 of 7

Thread: copy multiple files help needed

  1. #1
    Member
    Real Name
    Paul Hunter
    Join Date
    Aug 2014
    Posts
    87

    Default copy multiple files help needed

    Hello,
    I am trying to copy CSV files from a quantity of anything from one to many files from a folder.
    The folder is anywhere on the computer and needs to be searched for to get the proper files.
    I can do one file at a time, but when I try to do multiple files in same directory I cannot get it to work.

    I am obviously doing something wrong, so can someone please correct what I am doing wrong here?
    I commented the line out that does not work and included the single file select that does work.
    When I comment out the single file line and uncomment the multi file select, it just gives folders and no files. I'm looking to only find CSV files.

    Code:
    FUNCTION movefiles AS C ( )
    	import_filename = ""
    	'import_filename = ui_get_files_multiple("Choose","(*.csv)","C:\ "," ")
    	import_filename = ui_get_file("Choose","(*.csv)","C:\ "," ")
    	if import_filename = ""
    	'dlg_msg_box("You did not copy any files to the import folder")
    	end
    	end if
    Thank you!
    Paul

  2. #2
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,665

    Default Re: copy multiple files help needed

    Quote Originally Posted by datacaster View Post
    Hello,
    I am trying to copy CSV files from a quantity of anything from one to many files from a folder.
    The folder is anywhere on the computer and needs to be searched for to get the proper files.
    I can do one file at a time, but when I try to do multiple files in same directory I cannot get it to work.

    I am obviously doing something wrong, so can someone please correct what I am doing wrong here?
    I commented the line out that does not work and included the single file select that does work.
    When I comment out the single file line and uncomment the multi file select, it just gives folders and no files. I'm looking to only find CSV files.

    Code:
    FUNCTION movefiles AS C ( )
    	import_filename = ""
    	'import_filename = ui_get_files_multiple("Choose","(*.csv)","C:\ "," ")
    	import_filename = ui_get_file("Choose","(*.csv)","C:\ "," ")
    	if import_filename = ""
    	'dlg_msg_box("You did not copy any files to the import folder")
    	end
    	end if
    Thank you!
    Paul
    Look at the difference in the arguments for each function.

    GetFileVsGetMultipleFiles.jpg
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    Member
    Real Name
    Paul Hunter
    Join Date
    Aug 2014
    Posts
    87

    Default Re: copy multiple files help needed

    Hi Al,

    Thank you for the response and help here.
    I corrected the line to match the proper format and now see the .csv files. So now I see using this method that I have to select each file, one by one to build a list of files to copy and then click OK. I was looking for a way to browse to the directory and select all the files at once by holding ctrl and clicking all files I want to copy or shift and arrow up or down to highlight the files to copy and then say OK. Do you know if this possible and what code is needed?

    Code:
    FUNCTION movefiles AS C ( )
    	import_filename = ""
    	import_filename = ui_get_files_multiple("Choose the files to import to the program","C:\ ","(*.csv)","C:\ ")
    	'import_filename = ui_get_file("Choose the file to import to program","(*.csv)","C:\ "," ")
    	if import_filename = ""
    	'dlg_msg_box("You did not copy any files to the import folder")
    	end
    	end if
    Thank you!

    Paul

  4. #4
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,665

    Default Re: copy multiple files help needed

    myfolder=ui_get_path("Choose","C:\ ;D:\ ","C:\ ")

    dim lst as C
    lst = filefind.get(myfolder+"*.csv")


    copy_files(myfolder,<??targetfolder??>,lst)

    If you want to choose only some of the csv files, you'll need a xdialog to choose them off the lst.

    Do you want to copy the files or move them?
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  5. #5
    Member
    Real Name
    Paul Hunter
    Join Date
    Aug 2014
    Posts
    87

    Default Re: copy multiple files help needed

    Hi Al,
    On this I would need to select the specific CSV files to copy.
    Moving might be the best, as copy works on single files as I have a line that says delete the file after copy, so either works.
    I discovered that on multi-file copy, I am not reading the variable right and it can only do one file at a time.
    I'll look over what you put above. I did something similar, but coded it wrong as it didn't work.
    I'll give a stab at above information and see what happens.

    Thank you very much,
    Paul

  6. #6
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,665

    Default Re: copy multiple files help needed

    Show your code so we can see what you are doing.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  7. #7
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,229

    Default Re: copy multiple files help needed

    Hi Paul,
    As Al has demonstrated, you are attempting to sequence two different events into one action:
    Event 1: Identify the folder containing the CSV files the action is to act upon.
    Event 2a: To all the files in that folder perform the desired action.
    Event 2b: To some of the files in that folder, perform the desired action.

    Al gave the code for sequencing Event 1 and then Event 2a. To execute Event 1 and then 2b, you will have to introduce a file selection step, best performed by listing the folder files in a multi-select dialog, selecting them, and executing the action. Bread and butter.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

Similar Threads

  1. Code Help Needed! Complex Data Copy from One to another
    By markbwillard in forum Alpha Five Version 11 - Desktop Applications
    Replies: 15
    Last Post: 11-08-2013, 12:00 PM
  2. Help needed to copy a new record in a sql grid with a detail view
    By HRSue in forum Application Server Version 11 - Web/Browser Applications
    Replies: 19
    Last Post: 03-20-2013, 12:20 PM
  3. Where are the Alpha 5 ver 11 files & should I copy all my ver 10 files into them...
    By blonjuan44 in forum Alpha Five Version 11 - Desktop Applications
    Replies: 2
    Last Post: 06-09-2012, 03:27 AM
  4. Help needed to copy one set of tables to another
    By Alastair in forum Alpha Five Version 8
    Replies: 34
    Last Post: 11-29-2007, 10:05 AM
  5. Guidance needed- copy record
    By vinyltap in forum Web Application Server v7
    Replies: 34
    Last Post: 06-01-2006, 11:18 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •