Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Copy from the curent directory to...

by tachyon (Chancellor)
on Dec 30, 2003 at 00:24 UTC ( [id://317592]=note: print w/replies, xml ) Need Help??


in reply to Copy from the curent directory to...

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://317592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-25 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found