Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You are kidding right? Try this (you type it at the command prompt - Start|Run|cmd.exe):

C:\>copy /? Copies one or more files to another location. COPY [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] source Specifies the file or files to be copied. /A Indicates an ASCII text file. /B Indicates a binary file. destination Specifies the directory and/or filename for the new fil +e(s). /V Verifies that new files are written correctly. /N Uses short filename, if available, when copying a file +with a non-8dot3 name. /Y Suppresses prompting to confirm you want to overwrite a +n existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line. Default is to prompt on overwrites unless COPY command is being executed from within a batch script. To append files, specify a single file for destination, but multiple f +iles for source (using wildcards or file1+file2+file3 format). C:\>

So to do it just type (say this) at the command prompt:

copy blabla.jpg c:\games copy .\*.jpg c:\all_jpegs

The DOT dir is the current dir and * is a wildcard that matches anything so .\*.jpg means match anything in the current directory that ends in .jpg. You can call shell from perl like this using backtics

#!/usr/bin/perl `copy blabla.jpg c:\\games`;

NOTE you need 2 backslashes everyhwere you want a single backslash because of the special nature of the \ char in strings ie \n is a newline and \\ is a literal backslash.

You can also use the File::Copy module which has the advantage of working across operating systems although somehow I don't see that as a likely issue for you.

#!/usr/bin/perl use File::Copy; copy( 'file1', 'file2' );
<code>

cheers

tachyon


In reply to Re: Copy from the curent directory to... by tachyon
in thread Copy from the curent directory to... by freak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-24 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found