UNIX file copy

CeeBee

Expert Member
Joined
Jul 27, 2006
Messages
2,281
Reaction score
101
Location
Pta mostly
hi guys, me on my knees again for advice on UNIX pls :confused:
I'm trying to copy files in UNIX, similar to the windows xcopy 1*.* Z*.* command that would change all files in the dir from starting with 1 to starting with Z, like 1APCTL -> ZAPCTL
The command I've got in the instruction is ./cpchg 1 Z which 'should' make a copy of all the 1blabla files and then change to Zblabla, but unix just gives me the finger, like the cmd doesnt exist...
I have done this a few months ago, got it right then, but I just cannot remember if it also didn't work then and I had to try something else :mad:
If I try cp 1* Z* to copy or mv 1* Z* to rename, I get message that Z* must be a directory... duh!
now if I just do one file at a time, e.g. cp 1WIPSUB.idx ZWIPSUB.idx, it works just fine, but there are hundreds of files, don't wanna do one at a time :sick:
If I FTP the files from UNIX to windows pc, do xcopy and ftp back, it brings the files in as small letters (?!) ZCTL -> zctl, and seems UNIX is mos case sensitive...
I need this to copy live company in Syspro to test company.
Any advice will be sooooo apreciated!
 
Last edited:
Hi, does your cpchg have execute permission. I seem to remeber the first time i used cpchg got the same error, and just had to assign execute permissions to it...worked like a dream after that...
 
these are all data and index files (of the data files) only...
how to assign execute permission to cpchg... and is it really ./cpchg filename filename , or just cpchg filename filename ?
 
I normally use one-liners....

for i in `ls 1*`; do j=${i//1/Z}; mv $i $j; done

That will rename all files starting with 1 to start with Z

PS. I do this in bash

disclaimer : I did not try if this really works!!! :rolleyes:
 
Last edited:
hi, cpchg is a script file, it should have execute permissions to run, not the data/index files. Does the cpchg file exist in your syspro data directory?
 
"./cpchg filename filename" is the correct syntax...
I used to use "chmod 777 filename" to set the permissions, not sure that's strictly correct...
 
chmod 777 cpchg

does the script file cpchg exist?

check with

which cpchg
 
daaaamn, if u sharp then u sharp! :D and u guys are sharp!
I just copied the 1* files from the data dir and NOT the cpchg too, figured it just a command... I had a look now, its there, so I copied it to the other dir, and at least now UNIX seems to know wtf I mean by do cpchg!
hell, school neva ends :D

just tried it now.... u can see it working, looks like it takes each file and does a cp 1file Zfile, just like the manual 1by1 operation, without the d00s on the other side of the screen having to do it!
thanx a helluva lot 4 yer help guys!
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X