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
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
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"
Summary: Would you please help me write a script to move file between dirs? I am new to unix. But I need this for my work. The script should check id and pw. thanks. ...
Summary: Hello I need to write a simple batch script to delete all the files in a particular directory which are older than 24 hours. Sound simple, but to a newbee this is very tough. Please help...
Summary: Hello, I have a over 1000 files on a linxu box and I need to rename them. Can you write me a simple script which do the job. Here is my files format: dsfds.gif dfddfa.gif eoirewuro.gif gklfgf.gif oi...