Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 07, 2016, 02:16:48 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: rcopy 1.0.0.4  (Read 2561 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
rcopy 1.0.0.4
« on: January 11, 2012, 07:25:36 PM »
rcopy

Here's the Readme that explains what it is and why I wrote it:



        Readme file for rcopy v. 1.0.0.4

  rcopy is a command line program to recursively copy
  files matching FilePattern to a Destination Folder.
  If FilePattern contains a valid path, it will be set
  as the working directory, or starting point for the copy.
  Otherwise the current path in the command prompt is the
  working directory.  The target folder must already exist.
  No folder structure is created.  All files are copied to
  the same target folder.

  Platform: Windows XP and later both x32 and x64. Itanium
  not supported.

  Install:  Copy the 3 files, rcopy.exe rcopy_slave.exe and
  rcopy_slave_x64.exe to a folder in the PATH.  rcopy.exe
  selects the correct slave program to run depending if the
  OS is 32 bit or 64 bit. The reason for the 2 slave versions
  is on 64 bit Windows, when 32 bit programs are run, some folder
  access is redirected. By running the 64 bit version on the
  64 bit OS, related problems are avoided.

  Usage:

      rcopy

        Run with no args shows Usage MsgBox with Donate Button.
        See this dialog for examples and more information.

      rcopy [/n] FilePattern  DestFolder

        /n = Do Not Overwrite existing files in DestFolder.
        Default is to overwrite target files.

  I wrote rcopy because other command line copy commands such
  as xcopy want to recreate the folder structure in the target.
  The idea of rcopy is to produce the same effect as searching
  a file pattern in Explorer, then dragging the files to a
  target folder, but using the command line.

  Note: When rcopy is run, it does a recursive file search and
  tallies the count of files matching FilePattern. If this total
  is greater than 128, it pops up a MsgBox confirming you wish to
  go ahead with the copy. This is a sanity check to avoid situations
  such as copying *.* in the root of C:\ drive etc..

  Why multiple exe files? The slave programs are written in
  AutoHotKey.  AHK provides no way to compile a console app.
  It cannot output to the command line in a way a user would
  expect from a command line program. The rcopy.exe program
  is a simple AutoIt3 console program to call the correct slave
  program and get the return value, the number of files copied,
  and output that information to the command line.

  AHK has excellent recursive copy capabilities that made it easy
  to write the utility. The reason for multiple exe files is using
  the correct tool for each part of the job.  The file redirection
  used on 64 bit Windows OS is another incentive to use multiple
  processes. Since all 3 exe files total less than 3 MB it's simpler
  just to copy them all to a folder in the PATH.

  Uninstall: None of the programs create any .ini files or Registry
  settings. Just delete the 3 exe files.

  Important Note: I wrote this utility for my own use. You are
  welcome to use it at your own risk. I only have English Language
  versions of Windows for testing. Your mileage may vary. I hope you
  find the utility useful.

  MilesAhead

revisions

v. 1.0.0.4  Initial release.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,845
    • View Profile
    • Donate to Member
Re: rcopy 1.0.0.4
« Reply #1 on: January 11, 2012, 11:57:25 PM »
  Why multiple exe files? The slave programs are written in
  AutoHotKey.  AHK provides no way to compile a console app.
  It cannot output to the command line in a way a user would
  expect from a command line program
.

I presume you looked at Lexikos' ConsoleSend and the tidbits in the associated thread.  Out of curiosity, what functionality is missing or is off?  I tried out some of the code from the associated thread and thought it was possible to get output displayed within the console the code was launched from so I'm guessing the bold-faced portion of the quote above is relevant.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,285
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: rcopy 1.0.0.4
« Reply #2 on: January 12, 2012, 01:50:10 AM »
As Lexikos mentions himself, you can get odd behavior such as the console returning to the prompt while the program is still running.  Also see my follow-up to this thread:

http://www.autohotke...27854&highlight=



At the time I posted I was getting cursor hang in the console window after using console attach. I solved it by using Send with the Enter key(Send to window not ConsoleSend. Tried sending all kinds of combinations or return and linefeed through the function. Never got the prompt back.)  Later after modifying the app I got the "return to prompt while the app was still running" quirk. It just doesn't act like a console app. I could just use MsgBox to report the number of files copied, but I wanted to output to the console unless there was an error or a good reason to ask the user for input(such as do you really want to copy 20000 files?) :)

« Last Edit: January 12, 2012, 02:19:11 AM by MilesAhead »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,845
    • View Profile
    • Donate to Member
Re: rcopy 1.0.0.4
« Reply #3 on: January 12, 2012, 03:41:44 AM »
Thanks for the elaboration :)