Hi,
I have a txt file which contains a list of file addresses and i want to copy them one by one and rename then regardless what they are to 1,2,3,4,5,....
and since I have the list handy, I could I always know what each file is
So As I tested
works well, and cp the file and rename it to 2
However, for some reason my code does not work
PS: I am using "SH" and bash is there is any different
PLZ help
the error is :
cp: target `./_Tem/1' is not a directory
cp: target `./_Tem/2' is not a directory
cp: target `./_Tem/3' is not a directory
cp: target `./_Tem/4' is not a directory
cp: target `./_Tem/5' is not a directory
YES it is exist :
Here is the full code:
It suppos to find all file with chosen ext, and copy them in the folder "_Tem"
I first gram the addresses / make the dir and then cp
Your problem is probably the line in red:
The reason being that the shell might try to expand the iname predicate in the current directory, resulting in more than one file printed on one line. And cp requires the target (last argument) to be a directory if more than 1 file is to be copied.
Try replacing the double with single quotes, and run the command by itself to check the result first.
There we've got the culprit! The spaces in the directory name acts as a separator between command line arguments, so to cp it look like you're trying to copy (for example) the files "THE" and "GAME/HelloWorldSwing.class" to a single file, instead of a directory. And of course it complains. Apply the changes in red from below, and it should run as intended:
I have a txt file with a list of error messages in a xml tag format, and each error message is separated with a identifier(endresult).Need to split that and copy and create a new html file.Error message has some special character. how to escape the special character and insert my data into the... (7 Replies)
Hi,
I have a files in a directory as below :-
ls -1
mqdepth-S1STC02
proc-mq-S1STC01
proc-mq-S1STC02
proc-mq-S1STC03
Whereever i have S1STC i need to copy them into new file with file name S2STC.
expected output :-
ls -1
mqdepth-S2STC02
proc-mq-S2STC01
proc-mq-S2STC02... (3 Replies)
Hi experts
cp bin root src /mnt
but not copy bin/bigfile
any help?
( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum)
Thanks (6 Replies)
I need to
"Ensure that when you download libchat.a from the VLE you have copied it to the same folder on ius as your source files. You then refer to the library (and the libraries it needs) with:
gcc -o outputfile sourcefile.c -L. -lchat -lsocket -lnsl"
But I have no idea what this means! (I... (2 Replies)
Hi guys,
I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.
I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also... (1 Reply)
I so desperately need a script to copy a windows csv file to my unix server and i know these should be at dummies but i have no bits. it is life & no job situation help please. thanks (1 Reply)
Hi,
I am a newbie to AIX, so please bear with me. I have mounted a dvd drive on AIX. I am trying to copy the file that is on the dvd drive on to the local machine. However, I get an error:
cp: c1m_0001.gz: A system call received a parameter that is not valid.
Can some one point me to the... (1 Reply)
Hi all
I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far:
File A
line 1
line 2
line 3
line 4
... (6 Replies)
Hi all,
I wanted to know how i can copy a file to a directory and then verify if that file is completely copied or not?
Now the issues here is that the dir and the source file are to be sent as arguments to a function( this function should actually copy the files to a dir, then check if its... (0 Replies)