Computing.Net > Forums > Unix > Simple script to copy files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple script to copy files

Reply to Message Icon

Name: Morty
Date: January 22, 2003 at 06:39:35 Pacific
OS: HPUX
CPU/Ram: P3
Comment:

I'm trying to automate a task I do to copy files. I have a reference file is always something like: 2110filenamehere.prn. I want to automate the cp command I use now. Only the 2110 part of the file name changes with each copy. The 2110 changes to: 2120, 2130, 2450, 2460 - the referencefile.prn is the constant. Can anyone help?
Thanks,
Mike



Sponsored Link
Ads by Google

Response Number 1
Name: Neel
Date: January 22, 2003 at 11:20:13 Pacific
Reply:

Have your tried with

cp 2???filenamehere.prn /

I think it will work.
njoy,

~ Neel !!


0

Response Number 2
Name: Morty
Date: January 23, 2003 at 05:41:49 Pacific
Reply:

Neel, thanks for responding however, I want to automate the copy function with a script. I know how to use cp and it is time consuming to retype the filenames.
I don't have enough knowledge to write a simple script to handle this in a batch.
Mike


0

Response Number 3
Name: Neel
Date: January 23, 2003 at 09:22:04 Pacific
Reply:

Well theres no need to retype the file names.. when you use the Wildcards as mentioned . It will copy all the files in the same format..
please let me know if am missing anythign ?


0

Response Number 4
Name: Heapster
Date: January 27, 2003 at 03:22:36 Pacific
Reply:

To automate this job create a file with your cp command in (using the wildcards shown above) and make that file executable.

Use the "crontab -e" command and create a line to run everyday to run the file you have created and hey presto, automation has occured!

If your are unsure about cron use the command "man crontab"


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Simple script to copy files

script to move file www.computing.net/answers/unix/script-to-move-file/4235.html

Writing batch script to delete files www.computing.net/answers/unix/writing-batch-script-to-delete-files/120.html

Script to rename files www.computing.net/answers/unix/script-to-rename-files/4143.html